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>
//#include "grader.cpp"
using namespace std;
#define ll long long
#define sc second
#define fr first
#define pb push_back
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> a(23,vector<int>(n,0));
for(int i=1;i<=n;i++){
int tmp=i;
for(int j=0;j<7;j++) tmp/=3;
a[0][i]=19+tmp%3;
}
for(int i=1;i+1<(int)a.size();i++){
if(((i-1)/3)%2==0){
a[i][0]=1;
for(int j=1;j<=n;j++){
int tmp=j;
for(int k=0;k<=(i-1)/3;k++) tmp/=3;
if(tmp%3>(i-1)%3)
a[i][j]=-1;
else if(tmp%3<(i-1)%3)
a[i][j]=-2;
else{
int tmp=j;
for(int k=0;k<(i-1)/3;k++)
tmp/=3;
if((i-1)/3==0){//<-
if(tmp%3==0)
a[i][j]=-2;
else if(tmp%3==2)
a[i][j]=-3;
else
a[i][j]=22;
}
else{
a[i][j]=((i-1)/3-1)*3+tmp%3+1;
}
}
}
}
else{
a[i][0]=1;
for(int j=1;j<=n;j++){
int tmp=j;
for(int k=0;k<=(i-1)/3;k++) tmp/=3;//<-
if(tmp%3>(i-1)%3)
a[i][j]=-2;
else if(tmp%3<(i-1)%3)
a[i][j]=-1;
else{
int tmp=j;
for(int k=0;k<(i-1)/3;k++)
tmp/=3;
a[i][j]=((i-1)/3-1)*3+tmp%3+1;
}
}
}
}
for(int i=1;i<=n;i++){
if(i%3==0) a[22][i]=-1;
else if(i%3==2) a[22][i]=-2;
}
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |