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;
vector<vector<int>> devise_strategy(int N) {
int x=3*13-1;
vector<vector<int>> ans(x+1,vector<int>(N+1,0));
for(int i=0;i<=x;i++)ans[i][0]=((i%3)!=0);
for(int i=0;i<x-1;i++){
for(int j=1;j<N+1;j++){
int p = i/3;
int b = 12-p;
if(i%3==0){
if(j&(1<<b))ans[i][j]=i+1;
else ans[i][j]=i+2;
}else if(i%3==1){
if(j&(1<<b))ans[i][j]=i+2;
else ans[i][j]=-2;
}else{
if(j&(1<<b))ans[i][j]=-1;
else ans[i][j]=i+1;
}
}
}
for(int j=1;j<N+1;j++){
if(j&1)ans[x-1][j]=0;
else ans[x-1][j]=-2;
if(j&1)ans[x][j]=-1;
else ans[x][j]=0;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |