Submission #927346

#TimeUsernameProblemLanguageResultExecution timeMemory
927346velislavgarkovPrisoner Challenge (IOI22_prison)C++17
0 / 100
0 ms600 KiB
#include "prison.h" #include <iostream> #include <vector> using namespace std; vector <vector <int> > sol; int decide(int number, int s) { if (number==0) { if ((s & (1<<12))) return 1; return 2 + ((s & (1<<12)) > 0); } if (number==1) { if ((s & (1<<12))) return 6; return -2; } number-=2; int last, cur, type; type=sol[number+2][0]; last=11-number/2; if (last==11 && (s & (1<<12))) return -1; 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(24); for (int i=0;i<24;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...