제출 #979708

#제출 시각아이디문제언어결과실행 시간메모리
979708sleepntsheep죄수들의 도전 (IOI22_prison)C++17
0 / 100
1 ms348 KiB
#include "prison.h" #include <vector> std::vector<std::vector<int>> devise_strategy(int N) { int X = 31; std::vector<std::vector<int> > s(X+1, std::vector<int>(N+1)); auto get = [&](int x, int i) { while(i--) x/=3; return x%3; }; s[0][0] = 0; for(int i=1;i<=N;++i) s[0][i]=8*3 + get(i,8) + 1; for(int read=1;read<=X;++read) { int at=(read-1)/3; int dd=(read-1)%3; s[read][0]=1; if (at>0) { for(int i=1;i<=N;++i) { int ee=i&3; if(ee==dd) s[read][i]=(at-1)*3 + get(i,at-1) + 1; else if (ee>dd) s[read][i]=-1; else s[read][i]=-2; } } else { for(int i=1;i<=N;++i) { int ee=i&3; if(ee<dd) s[read][i]=-2; else if(ee>dd) s[read][i]=-1; else /* unreachable ? */ s[read][i]=-2; } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...