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<bits/stdc++.h>
#include "prison.h"
using namespace std;
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>> s;
int w[9] = {5102, 1700, 566, 188, 62, 20, 6, 2, 1};
for(int i=0; i<=0; i++){
vector<int> v;
v.push_back(0);
for(int j=1; j<=N; j++){
int I = 1+(j-2)/1700;
if(j==1) I = -1;
if(j==5102) I=-2;
v.push_back(I);
}
s.push_back(v);
}
for(int i=1; i<=20; i++){
vector<int> v;
v.push_back((1+(i-1)/3)%2);
int t=(i-1)%3;
int L = (i-1)/3+1;
for(int j=1; j<=N; j++){
int J1=j;
int J2=j;
for(int k=1; k<L; k++){
J1=1+(J1-2)%w[k];
}
J2=1+(J1-2)%w[L];
int I;
if(J1==1){
I=0-(1+L%2);
}else if(J1==w[L-1]){
I=0-(1+(L+1)%2);
}else{
I=(J1-2)/w[L];
if(I==t){
I = 3*L+1+(J2-2)/w[L+1];
if(J2==1){
I=0-(1+L%2);
}else if(J2==w[L]){
I=0-(1+(L+1)%2);
}
}else if(I<t){
I=0-(1+L%2);
}else if(I>t){
I=0-(1+(L+1)%2);
}
}
if(I>20) I=-1;
if(I<-2) I=-1;
v.push_back(I);
}
s.push_back(v);
}
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... |