이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int,int>
#define fi first
#define se second
#define puf push_front
#define pof pop_front
#define pub push_back
#define pob pop_back
#define lb lower_bound
#define ub upper_bound
#define rep(x,s,e) for (int x=(s)-((s)>(e));x!=(e)-((s)>(e));((s)<(e))?x++:x--)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int) (x).size()
mt19937 rng(chrono::system_clock::now().time_since_epoch().count());
const int MAGIC[]={0,2,3,3,3,3,3,3}; //stupid problem
int pref[9];
int offset[9];
int n;
vector<vector<signed> > v;
void solve(int l,int r,int pl,int pr,int layer,int res){
rep(x,pl,l+1) if (x<=n) v[offset[layer]+res][x]=-1;
rep(x,r,pr+1) if (x<=n) v[offset[layer]+res][x]=-2;
if (layer){
int len=(r-l-1)/MAGIC[layer];
rep(x,0,MAGIC[layer]){
int l2=l+1+x*len,r2=l2+len-1;
rep(y,l2,r2+1) if (y<=n) v[offset[layer]+res][y]=offset[layer-1]+x;
solve(l2,r2,l,r,layer-1,x);
}
}
}
vector<vector<signed> > devise_strategy(signed N){
n=N;
v=vector<vector<signed> >(21,vector<signed>(n+1,0));
pref[0]=0;
rep(x,0,8) pref[x+1]=pref[x]*MAGIC[x]+2;
offset[7]=0;
offset[6]=1;
rep(x,6,0) offset[x]=offset[x+1]+MAGIC[x+2];
solve(1,pref[8],1,pref[8],7,0);
for (int x=0;x<7;x+=2) rep(y,offset[x+1],offset[x]) v[y][0]=1;
rep(x,0,21) if (v[x][0]) for (auto &it:v[x]) if (it<=-1) it^=1;
rep(x,0,21){
for (auto it:v[x]) cout<<it<<" "; cout<<endl;
}
return v;
}
컴파일 시 표준 에러 (stderr) 메시지
prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:64:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
64 | for (auto it:v[x]) cout<<it<<" "; cout<<endl;
| ^~~
prison.cpp:64:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
64 | for (auto it:v[x]) cout<<it<<" "; cout<<endl;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |