제출 #927352

#제출 시각아이디문제언어결과실행 시간메모리
927352velislavgarkov죄수들의 도전 (IOI22_prison)C++17
72 / 100
14 ms1640 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<<11)) > 0); } if (number==1) { if ((s & (1<<12))) return 4; 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 2+(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 if (i==1) sol[i][0]=1; else sol[i][0]=((i-2)/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...