Submission #762128

#TimeUsernameProblemLanguageResultExecution timeMemory
762128raysh07Prisoner Challenge (IOI22_prison)C++17
0 / 100
0 ms212 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans(27, vector<int>(n + 1)); for (int i = 0; i <= 26; i++){ if (i == 0){ int bit = 12; ans[i][0] = 0; for (int j = 1; j <= n; j++){ ans[i][j] = 1 + (j >> bit & 1); } } else if (i % 4 == 1 || i % 4 == 2){ int bit = 12 - (i / 4); ans[i][0] = 1; for (int j = 1; j <= n; j++){ int a = (i % 4) - 1; int b = j >> bit & 1; if (a > b) ans[i][j] = -2; else if (a < b) ans[i][j] = -1; else { bit++; int x = i + 1; if (i % 4 == 1) x++; ans[i][j] = x + (j >> bit & 1); } } } else { int bit = 12 - (i + 1) / 4; ans[i][0] = 0; for (int j = 1; j <= n; j++){ int b; if (i % 4 == 0) b = 1; else b = 0; int a = j >> bit & 1; if (a > b) ans[i][j] = -2; else if (a < b) ans[i][j] = -1; else { bit++; int x = i + 1; if (i % 4 == 3) x++; ans[i][j] = x + (j >> bit & 1); } } } } for (auto &x : ans) for (auto &y : x) if (y > 26) y = 0; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...