Submission #776935

#TimeUsernameProblemLanguageResultExecution timeMemory
776935alexander707070Prisoner Challenge (IOI22_prison)C++17
65 / 100
10 ms1708 KiB
#include<bits/stdc++.h> using namespace std; pair<int,int> w[100]; int to[100][2]; vector< vector<int> > sol; int pos,bit,n; vector< vector<int> > devise_strategy(int N){ n=N; for(int i=1;i<13;i++){ for(int f=0;f<2;f++){ to[i][f]=i*2+f+1-2; w[i*2+f+1-2]={i,f}; } } to[13][0]=0; w[0]={13,0}; sol.resize(25); for(int i=0;i<25;i++){ pos=w[i].first; bit=w[i].second; if(pos%2==1)sol[i].push_back(0); else sol[i].push_back(1); for(int f=1;f<=n;f++){ if(pos==13){ if((f&(1<<(pos-1)))>0)sol[i].push_back(to[pos-1][1]); else sol[i].push_back(to[pos-1][0]); }else if(pos>1){ if((f&(1<<pos))>0 and bit==0){ if(pos%2==1)sol[i].push_back(-2); else sol[i].push_back(-1); }else if((f&(1<<pos))==0 and bit==1){ if(pos%2==1)sol[i].push_back(-1); else sol[i].push_back(-2); }else{ if((f&(1<<(pos-1)))>0)sol[i].push_back(to[pos-1][1]); else sol[i].push_back(to[pos-1][0]); } }else if(pos==1){ if((f&(1<<pos))>0 and bit==0){ if(pos%2==1)sol[i].push_back(-2); else sol[i].push_back(-1); }else if((f&(1<<pos))==0 and bit==1){ if(pos%2==1)sol[i].push_back(-1); else sol[i].push_back(-2); }else{ if((f&(1<<(pos-1)))>0){ if((pos-1)%2==1)sol[i].push_back(-1); else sol[i].push_back(-2); }else{ if((pos-1)%2==1)sol[i].push_back(-2); else sol[i].push_back(-1); } } } } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...