Submission #642486

#TimeUsernameProblemLanguageResultExecution timeMemory
642486birthdaycakePrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include "prison.h" #include<bits/stdc++.h> #define endl '\n' #define mod 1000000007 using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>>ans; vector<int>d; d.push_back(0); for(int i = 1; i <= N; i++) { if(i == 1) d.push_back(-1); else if(i == N) d.push_back(-2); else if(i & (1 << 12)) d.push_back(1); else d.push_back(2); } ans.push_back(d); d.clear(); bool turn = 0; int cnt = 12; for(int j = 1; ; j++){ if(turn){ // check a cnt--; if(cnt == -1) break; d.push_back(0); for(int i = 1; i <= N; i++){ if(i == 1) d.push_back(-1); else if(i == N) d.push_back(-2); else if(i & ((1 << cnt))) d.push_back(j + 2); else d.push_back(j + 3); } ans.push_back(d); d.clear(); }else{ d.push_back(1); for(int i = 1; i <= N; i++){ if(i == 1) d.push_back(-2); else if(i == N) d.push_back(-1); else if(i & ((1 << cnt))) d.push_back(j + 2); else d.push_back(-2); } ans.push_back(d); d.clear(); d.push_back(1); for(int i = 1; i <= N; i++){ if(i == 1) d.push_back(-2); else if(i == N) d.push_back(-1); else if(i & ((1 << cnt))) d.push_back(-1); else d.push_back(j + 2); } ans.push_back(d); d.clear(); j++; } turn = !turn; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...