Submission #628710

#TimeUsernameProblemLanguageResultExecution timeMemory
628710abdzagPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> #include "prison.h" using namespace std; std::vector<std::vector<int>> devise_strategy(int N) { int n=N; vector<vector<int>> ans(40,vector<int>(N+1)); ans[0][0]=1; for(int i=1;i<=n;i++){ int next_index=12; ans[0][i]=next_index*2+(((1<<next_index)&i)?2:1); } for(int i=1;i<=30;i++){ int current_index=(i-1)/2; int current_value=(i-1)%2; ans[i][0]=current_index%2; // if(i==3)cout<<current_index<<" "<<current_value<<endl; for(int j=1;j<=n;j++){ if(((j&(1<<current_index))!=0)<current_value){ if(ans[i][0])ans[i][j]=-1; else ans[i][j]=-2; } else if(((j&(1<<current_index))!=0)>current_value){ if(ans[i][0])ans[i][j]=-2; else ans[i][j]=-1; } else { int next_index=current_index-1; if(next_index>=0) ans[i][j]=next_index*2+(((1<<next_index)&j)?2:1); } } } // cout<<ans[3][2]<<endl; return ans; } // int simulate(vector<vector<int>> ans, int a, int b){ // int cur=0; // while(cur>=0){ // if(!ans[cur][0])cur=ans[cur][a]; // else cur=ans[cur][b]; // } // return cur; // } // int main(){ // int n;cin>>n; // vector<vector<int>> ans=devise_strategy(n); // for(int i=1;i<=n;i++){ // for(int j=1;j<=n;j++){ // if(i==j)continue; // if(simulate(ans,i,j)==-1 ^ i>j){ // cout<<"failed when "<<i<<" "<<j<<" "<<simulate(ans,i,j)<<endl; // return 0; // } // } // } // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...