Submission #1056403

#TimeUsernameProblemLanguageResultExecution timeMemory
1056403amirhoseinfar1385Prisoner Challenge (IOI22_prison)C++17
72 / 100
7 ms1116 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; int n,lg=13; std::vector<std::vector<int>> devise_strategy(int N) { n=N; int x=23; vector<vector<int>>ret(x+1,vector<int>(n+1)); for(int i=0;i<=x;i++){ if(((i+1)/2)&1){ ret[i][0]=1; } if(i==23){ for(int j=1;j<=n;j++){ int x=j%4; if(x==3||x==2){ if(ret[i][0]){ ret[i][j]=-1; }else{ ret[i][j]=-2; } }else{ if(ret[i][0]){ ret[i][j]=-2; }else{ ret[i][j]=-1; } } } break; } int lev=(i-1)/2; if(i==0){ lev=0; } for(int j=1;j<=n;j++){ int z=((j>>(lg-lev-1))&1); if(i==0){ ret[i][j]=z+1; continue; } if(z==1&&(i%2)==1){ if(ret[i][0]){ ret[i][j]=-1; }else{ ret[i][j]=-2; } continue; } if(z==0&&(i%2)==0){ if(ret[i][0]){ ret[i][j]=-2; }else{ ret[i][j]=-1; } continue; } if(i>=21){ int x=j%4; if(x==0){ if(ret[i][0]){ ret[i][j]=-2; }else{ ret[i][j]=-1; } }else if(x==3){ if(ret[i][0]){ ret[i][j]=-1; }else{ ret[i][j]=-2; } }else{ ret[i][j]=23; } continue; } lev++; z=((j>>(lg-lev-1))&1); ret[i][j]=z+1+lev*2; lev--; } } /* for(int i=0;i<=x;i++){ for(int j=0;j<=n;j++){ cout<<ret[i][j]<<" "; } cout<<"\n"; }*/ return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...