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;
int n,lg=13;
std::vector<std::vector<int>> devise_strategy(int N) {
n=N;
int x=23;
vector<vector<int>>ret(x+1,vector<int>(n+1));
for(int i=0;i<=x;i++){
if(((i+1)/2)&1){
ret[i][0]=1;
}
if(i==23){
for(int j=1;j<=n;j++){
int x=j%4;
if(x==3||x==2){
if(ret[i][0]){
ret[i][j]=-1;
}else{
ret[i][j]=-2;
}
}else{
if(ret[i][0]){
ret[i][j]=-2;
}else{
ret[i][j]=-1;
}
}
}
break;
}
int lev=(i-1)/2;
if(i==0){
lev=0;
}
for(int j=1;j<=n;j++){
int z=((j>>(lg-lev-1))&1);
if(i==0){
ret[i][j]=z+1;
continue;
}
if(z==1&&(i%2)==1){
if(ret[i][0]){
ret[i][j]=-1;
}else{
ret[i][j]=-2;
}
continue;
}
if(z==0&&(i%2)==0){
if(ret[i][0]){
ret[i][j]=-2;
}else{
ret[i][j]=-1;
}
continue;
}
if(i>=21){
int x=j%4;
if(x==0){
if(ret[i][0]){
ret[i][j]=-2;
}else{
ret[i][j]=-1;
}
}else if(x==3){
if(ret[i][0]){
ret[i][j]=-1;
}else{
ret[i][j]=-2;
}
}else{
ret[i][j]=23;
}
continue;
}
lev++;
z=((j>>(lg-lev-1))&1);
ret[i][j]=z+1+lev*2;
lev--;
}
}
/* for(int i=0;i<=x;i++){
for(int j=0;j<=n;j++){
cout<<ret[i][j]<<" ";
}
cout<<"\n";
}*/
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |