제출 #626191

#제출 시각아이디문제언어결과실행 시간메모리
626191errorgorn죄수들의 도전 (IOI22_prison)C++17
0 / 100
6 ms804 KiB
#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; 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> >(22,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,22) if (v[x][0]) for (auto &it:v[x]) if (it<=-1) it^=1; return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...