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;
using ll=long long;
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define rep(i,b) rng(i,0,b-1)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
#define per(i,b) gnr(i,b-1,0)
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define si(x) int(x.size())
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pii=pair<int,int>;
using vi=vc<int>;
using uint=unsigned;
using ull=unsigned ll;
using pil=pair<int,ll>;
using pli=pair<ll,int>;
using pll=pair<ll,ll>;
using t3=tuple<int,int,int>;
int Get(int a, int b){
int i;
int U[8];
for(i=0;i<8;i++){
U[i] = a%3;
a/=3;
}
return U[b];
}
std::vector<std::vector<int>> devise_strategy(int N) {
int n = N;
vc<vc<int>>R(32,vi(N+1));
rng(i,1,n){
R[0][i] = Get(i,7) + 28;
}
R[0][0]=0;
rep(i,8){
int bas = i*4+1;
rep(j,3){
rng(k,1,n){
int t = Get(k,i);
if(t != j){
if(t < j)R[bas + j][k] = -2;
else R[bas+j][k] = -1;
}
else{
R[bas+j][k] = bas-1;
}
}
R[bas+j][0] = 1;
}
if(i!=7){
rng(k,1,n){
int t = Get(k,i);
R[bas + 3][k] = bas+t;
}
R[bas+3][0] = 0;
}
}
/* rep(i,31){
rng(j,0,n){
printf("%d ",R[i][j]);
}
puts("");
}*/
return R;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |