Submission #785228

#TimeUsernameProblemLanguageResultExecution timeMemory
785228vjudge1Prisoner Challenge (IOI22_prison)C++17
80 / 100
10 ms980 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int f(int a, int b) { while (b--) { a /= 3; } return a % 3; } vector<vector<int>> devise_strategy(int N) { vector a(23, vector<int>(N + 1)); for (int i = 10; i <= 21; i++) { a[i][0] = 1; } for (int j = 1; j <= N; j++) { for (int i = 0; i <= 9; i++) { int t = (9 - i) / 3 * 2 + 1; if (f(i, 0) != f(j, t + 1)) { a[i][j] = -2 + (f(i, 0) > f(j, t + 1)); } else { a[i][j] = 12 + (7 - t) / 2 * 3 - (3 - f(j, t)) % 3; } } for (int i = 10; i <= 21; i++) { int t = (21 - i) / 3 * 2; if (f(i, 0) != f(j, t + 1)) { a[i][j] = -1 - (f(i, 0) > f(j, t + 1)); } else { a[i][j] = (8 - t) / 2 * 3 - (3 - f(j, t)) % 3; if (t == 0) { if (f(j, t) == 0) { a[i][j] = -2; } else if (f(j, t) == 2) { a[i][j] = -1; } else { a[i][j] = 22; } } } } a[22][j] = -2 + (f(j, 0) == 0); } return a; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...