이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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=2048;
for(int i=1;i<=n;i++){
s[i]=i/m+1;
}
ans.push_back(s);
int fl=1;
int q=4;
for(;m>1;m>>=1){
if(q==4){
vector<int> x[3]={vector<int>(n+1),vector<int>(n+1),vector<int>(n+1)};
x[0][0]=x[1][0]=x[2][0]=fl;
for(int i=1;i<=n;i++){
for(int j=0;j<3;j++){
if(i/m!=j){
if(i/m>j){
x[j][i]=fl-2;
}
else{
x[j][i]=-1-fl;
}
}
else{
if(m==2){
x[j][i]=(i%m==0)?(-1-fl):(fl-2);
}
else{
x[j][i]=q+((i%m)>=(m/2));
}
}
}
}
ans.push_back(x[0]);
ans.push_back(x[1]);
ans.push_back(x[2]);
fl^=1;
q+=2;
}
else{
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... |