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>> v(27,vector<int>(N+1,0));
v[0][0]=0;
for(int i=1;i<=N;i++){
int d[14];
int num=i;
for(int z=13;z>=1;z--){
d[z]=num%2;
num/=2;
}
v[0][i]=d[1]*13+1;
}
for(int i=1;i<=26;i++){
int h,h2;
h=0;
if(i>13){
h=1;
}
h2=i-h*13;
v[i][0]=h2%2;
for(int j=1;j<=N;j++){
int d[15];
int num=j;
d[14] = 0;
for(int z=13;z>=1;z--){
d[z]=num%2;
num/=2;
}
if(h==d[h2]){
v[i][j]=h2+1+d[h2+1]*13;
}
else if(h>d[h2]){
v[i][j]=-h2%2-1;
}
else{
v[i][j]=h2%2-2;
}
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |