Submission #828492

#TimeUsernameProblemLanguageResultExecution timeMemory
828492dxz05Prisoner Challenge (IOI22_prison)C++17
47 / 100
14 ms1364 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int get(int num, int pos, int base){ while (pos--) num /= base; return num % base; } vector<vector<int>> devise_strategy(int N) { const int X = 32; const int base = 3; vector<vector<int>> s(X + 1, vector<int>(N + 1, 0)); s[0][0] = 0; for (int i = 1; i <= N; i++){ s[0][i] = 32; } for (int i = 1; i <= X; i++){ int b = (i - 1) / 4; int r = (i - 1) % 4; if (r == 3){ /// didn't open A s[i][0] = 0; for (int j = 1; j <= N; j++){ s[i][j] = b * 4 + 1 + get(j, b, base); } } else { /// opened A, bit was r s[i][0] = 1; for (int j = 1; j <= N; j++){ int c = get(j, b, base); if (c < r){ s[i][j] = -2; } else if (c == r){ s[i][j] = b * 4; } else { s[i][j] = -1; } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...