Submission #1230448

#TimeUsernameProblemLanguageResultExecution timeMemory
1230448clemmy14죄수들의 도전 (IOI22_prison)C++20
0 / 100
0 ms328 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int base3(int val, int i) { while(i--) val/=3; return val%3; } vector<vector<int>> devise_strategy(int N) { vector<vector<int>> s(25, vector<int>(N+1, 0)); for(int i=1; i<25; i++) s[i][0]=1-(i%2); for(int i=0; i<25; i++) { int ii = (i-1)%8; if(i == 0) { for(int j=1; j<=N; j++) { int now=base3(j, 7); s[i][j]=(now+1)*8; } } else if(ii == 0) { for(int j=1; j<=N; j++) { int now=base3(j, ii); if((i-1)/8 < now) s[i][j]=-2; else s[i][j]=-1; } } else { for(int j=1; j<=N; j++) { int now=base3(j, ii), prev=base3(j, ii-1); if(now < (i-1)/8) s[i][j]=(i%2 == 0 ? -2 : -1); else if(now == (i-1)/8) s[i][j]=prev*8+ii; else s[i][j]=(i%2 == 0 ? -1 : -2); if(ii == 1 && prev != 1) { if(prev == 0) s[i][j]=(i%2 == 0 ? -2 : -1); else s[i][j]=(i%2 == 0 ? -1 : -2); } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...