제출 #1011637

#제출 시각아이디문제언어결과실행 시간메모리
1011637bachhoangxuan죄수들의 도전 (IOI22_prison)C++17
65 / 100
9 ms1368 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; const int X=8; const int D=3; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> s(X*D+1,vector<int>(N+1,0)); vector<int> p(X,1); for(int i=1;i<X;i++) p[i]=p[i-1]*D; s[0][0]=X&1; for(int i=1;i<=N;i++) s[0][i]=D*(X-1)+(i/p[X-1])%D+1; for(int t=0;t<X;t++) for(int a=0;a<D;a++){ int i=t*D+a+1; s[i][0]=t&1; for(int j=1;j<=N;j++){ int b=(j/p[t])%D; if(a>b) s[i][j]=-s[i][0]-1; else if(a<b) s[i][j]=-(s[i][0]^1)-1; else if(t) s[i][j]=D*(t-1)+(j/p[t-1])%D+1; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...