Submission #729918

#TimeUsernameProblemLanguageResultExecution timeMemory
729918caganyanmazPrisoner Challenge (IOI22_prison)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; constexpr static int LIM = 32; vector<vector<int>> res; void evaluate_a(int a, int n) { res[a][0] = 0; int shft = 2 * (a / 5 - 1); for (int i = 1; i <= n; i++) { int oo = (i >> shft) & 3; res[a][i] = a - 5 + oo + 1; } } void evaluate_b(int a, int n) { res[a][0] = 1; int shft = 2 * (a / 5); for (int i = 1; i <= n; i++) { int oo = (i >> shft) & 3; if (oo + 1 > (a % 5)) res[a][i] = -2; else if (oo + 1 < (a % 5)) res[a][i] = -1; else res[a][i] = a - (a%5); } } void evaluate(int a, int n) { if (a % 5) evaluate_b(a, n); else evaluate_a(a, n); } vector<vector<int>> devise_strategy(int n) { res = vector<vector<int>>(LIM + 1, vector<int>(n+1)); res[0][1] = 0; for (int i = 1; i <= n; i++) res[0][1] = 32 - (i>>12); for (int i = 31; i <= 32; i++) { res[i][0] = 1; for (int j = 1; j <= n; j++) { if ((i&1) > (j>>12)) res[i][j] = -2; else if ((i&1) < (j>>12)) res[i][j] = -1; else res[i][j] = 30; } } for (int i = 1; i <= 30; i++) evaluate(i, n); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...