This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "prison.h"
#include <bits/stdc++.h>
//#include <cassert>
//#include <cstdio>
//
//#include <string>
//#include <vector>
using namespace std;
typedef int ll;
const ll N=1e6+9;
ll a,b,c,d,a1,b1,c1,val,i,sum1,j,n,m,pos,ans,sum,cur,res,ans1,res1;
ll k,kk,kkk,cnt,cnt1,l,r,x,y,mn,t,fl,q,bit;
vector<vector<int>> devise_strategy(int N) {
vector<vector<ll>>v(27,vector<ll>(N+1));
v[0][0]=0;
for(ll i=1;i<=N;i++){
v[0][i]=26+(i>>13&1);
}
for(ll i=1; i<=26; i++){
/// x = 2 * pos + bit
/// when x%2 == 0 -> ask(1)
if(i==1){
for(ll j=0;j<=N;j++){
v[i][j]=1;
}
continue;
}
bit=0;
if(i&1) bit=1;
pos=(i-(i&1))>>1;
v[i][0]=1-pos%2;
for(ll j=1;j<=N;j++){
if(v[i][0]==0){
if(bit==0 && (j>>pos&1)) v[i][j]=-2;
else if(bit==1 && (j>>pos&1)==0) v[i][j]=-1;
else v[i][j]=2*(pos-1)+(j>>(pos-1)&1);
}
else{
if(bit==0 && (j>>pos&1)) v[i][j]=-1;
else if(bit==1 && (j>>pos&1)==0) v[i][j]=-2;
else v[i][j]=2*(pos-1)+(j>>(pos-1)&1);
}
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |