This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 s[i][j]=D*(t-1)+(j/p[t-1])%D+1;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |