제출 #1044823

#제출 시각아이디문제언어결과실행 시간메모리
1044823Dan4Life죄수들의 도전 (IOI22_prison)C++17
0 / 100
1 ms348 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz(a) (int)a.size() #define all(a) begin(a),end(a) using ll = long long; using vi = vector<int>; const int mxN = (int)1e5+10; const ll LINF = (ll)2e18; const int mxX = 26; int pow2[15]; vector<vi> devise_strategy(int N) { pow2[0] = 1; for(int i = 1; i <= 14; i++) pow2[i]=pow2[i-1]*2; vector<vi> ans(mxX+1,vi(N+1,0)); int fi = 1, cur = 0; ans[0][cur] = 0; // if we are at 0, inspect A. for(int i = 1; i <= N; i++) ans[0][i] = 1+i/pow2[12]; for(int i = 12; i>0; i--){ cur^=1; for(int j = fi; j <= fi+1; j++){ ans[j][0] = cur; for(int k = 1; k <= N; k++){ int curA, curB = j-fi; curA=(k%pow2[i+1])/pow2[i]; if(cur) swap(curA,curB); if(curA<curB) ans[j][k]=-1; else if(curA>curB) ans[j][k]=-2; else ans[j][k] = fi+2+(k%pow2[i])/pow2[i-1]; } } fi+=2; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...