Submission #1056382

#TimeUsernameProblemLanguageResultExecution timeMemory
1056382amirhoseinfar1385Prisoner Challenge (IOI22_prison)C++17
56 / 100
9 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=26; 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; } 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(lev==lg-1){ ret[i][j]=-1; 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...