Submission #876466

#TimeUsernameProblemLanguageResultExecution timeMemory
876466AndreyPrisoner Challenge (IOI22_prison)C++17
56 / 100
10 ms1116 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; std::vector<std::vector<int>> devise_strategy(int n) { vector<vector<int>> ans(0); for(int i = 0; i < 27; i++) { ans.push_back(vector<int> (n+1)); } for(int i = 0; i < 27; i++) { if(i == 0) { ans[i][0] = 0; for(int j = 1; j <= n; j++) { ans[i][j] = 24; if(j&(1 << 12)) { ans[i][j]++; } } } else if(i == 1) { ans[i][0] = 0; for(int j = 1; j <= n; j++) { if(j%2) { ans[i][j] = -2; } else { ans[i][j] = -1; } } } else { int d = i/2; int c = d%2; bool x = i%2; if(c == 0) { ans[i][0] = 1; } else { ans[i][0] = 0; } for(int j = 1; j <= n; j++) { bool y = ((1 << d)&j); if(x < y) { if(c == 0) { ans[i][j] = -1; } else { ans[i][j] = -2; } } else if(x > y) { if(c == 0) { ans[i][j] = -2; } else { ans[i][j] = -1; } } else { if(d > 0) { if(d == 1) { ans[i][j] = 1; } else { ans[i][j] = d*2-2+((j&(1 << (d-1))) > 0); } } else { ans[i][j] = 4; } } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...