Submission #1074616

#TimeUsernameProblemLanguageResultExecution timeMemory
1074616zsomborPrisoner Challenge (IOI22_prison)C++17
48.50 / 100
13 ms2140 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int n; vector<vector<int> > v(32); int dig(int x, int j) { for (int i = 0; i < j; i++) x /= 3; return x % 3; } void solve0(int i) { int x = 7 - (i / 4); v[i][0] = 0; for (int j = 1; j <= n; j++) v[i][j] = i + 1 + dig(j, x); } void solve(int i) { int x = 7 - (i / 4), d = i % 4 - 1; v[i][0] = 1; for (int j = 1; j <= n; j++) { if (d == dig(j, x)) v[i][j] = (i + 3 - d) % 32; else v[i][j] = (d < dig(j, x) ? -1 : -2); } } vector<vector<int> > devise_strategy(int N) { n = N; for (int i = 0; i < 32; i++) { v[i].assign(n + 1, 0); (i % 4 ? solve(i) : solve0(i)); } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...