Submission #986540

#TimeUsernameProblemLanguageResultExecution timeMemory
986540Hugo1729Prisoner Challenge (IOI22_prison)C++17
38 / 100
18 ms1628 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { int s=0; while((1<<s)<=N)s++; int x=3*s-1; vector<vector<int>> ans(x+1,vector<int>(N+1,0)); for(int i=0;i<=x;i++)ans[i][0]=((i%3)!=0); for(int i=0;i<x-1;i++){ for(int j=1;j<N+1;j++){ int p = i/3; int b = s-p-1; if(i%3==0){ if(j&(1<<b))ans[i][j]=i+1; else ans[i][j]=i+2; }else if(i%3==1){ if(j&(1<<b))ans[i][j]=i+2; else ans[i][j]=-2; }else{ if(j&(1<<b))ans[i][j]=-1; else ans[i][j]=i+1; } } } for(int j=1;j<N+1;j++){ if(j&1)ans[x-1][j]=0; else ans[x-1][j]=-2; if(j&1)ans[x][j]=-1; else ans[x][j]=0; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...