Submission #927323

#TimeUsernameProblemLanguageResultExecution timeMemory
927323velislavgarkovPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms348 KiB
#include "prison.h" #include <iostream> #include <vector> using namespace std; vector <vector <int> > sol; int decide(int number, int s) { if (number==0) return 1 + ((s & (1<<13)) > 0); number--; int last, cur, type; type=sol[number+1][0]; last=13-number/2; bool l=(s & (1<<last)); if (number%2!=l) { if (number%2>l) return -1-type; return -1-!type; } cur=last-1; l=(s & (1<<cur)); if (cur==0) { if (l) return -1-!type; return -1-type; } return 1+(number/2+1)*2+l; } vector<vector<int> > devise_strategy(int N) { sol.resize(25); for (int i=0;i<25;i++) { sol[i].resize(N+1); if (i==0) sol[i][0]=0; else sol[i][0]=((i-1)/2+1)%2; for (int j=1;j<=N;j++) { sol[i][j]=decide(i,j); } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...