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>
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
int n;
vector<vector<int> > ans;
vector<vector<int>> devise_strategy(int N) {
n=N;
vector<int> s(n+1);
s[0]=0;
int m=4096;
for(int i=1;i<=n;i++){
if(i<m){
s[i]=1;
}
else{
s[i]=2;
}
}
ans.push_back(s);
int fl=1;
int q=3;
for(;m>1;m>>=1){
vector<int> x[2]={vector<int>(n+1),vector<int>(n+1)};
x[0][0]=x[1][0]=fl;
for(int i=1;i<=n;i++){
if(i%(2*m)>=m){
x[0][i]=fl-2;
if(m==2){
x[1][i]=(i%m==0)?(-1-fl):(fl-2);
}
else{
x[1][i]=q+((i%m)>=(m/2));
}
}
else{
if(m==2){
x[0][i]=(i%m==0)?(-1-fl):(fl-2);
}
else{
x[0][i]=q+((i%m)>=(m/2));
}
x[1][i]=-1-fl;
}
}
ans.push_back(x[0]);
ans.push_back(x[1]);
fl^=1;
q+=2;
}
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... |