Submission #1056113

#TimeUsernameProblemLanguageResultExecution timeMemory
1056113parsadox2Prisoner Challenge (IOI22_prison)C++17
56 / 100
11 ms1116 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; vector<vector<int>> devise_strategy(int n) { vector <vector<int>> res; for(int i = 0 ; i <= 26 ; i++) { vector <int> vec(n + 1 , 0); res.push_back(vec); } for(int i = 0 ; i <= 26 ; i++) { if(i == 0) { res[i][0] = 0; for(int j = 1 ; j <= n ; j++) res[i][j] = 2 * 12 + ((j >> 12) & 1) + 1; continue; } int bit = (i - 1) / 2; if(bit % 2 == 0) res[i][0] = 1; else res[i][0] = 0; int val = (i - 1) % 2; for(int j = 1 ; j <= n ; j++) { int v = (j >> bit) & 1; if(v != val) { if(val > v) { if(res[i][0] == 0) res[i][j] = -1; else res[i][j] = -2; } else { if(res[i][0] == 0) res[i][j] = -2; else res[i][j] = -1; } } else { if(bit == 0) continue; v = (j >> (bit - 1)) & 1; res[i][j] = 2 * (bit - 1) + 1 + v; } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...