Submission #626287

#TimeUsernameProblemLanguageResultExecution timeMemory
626287TemmiePrisoner Challenge (IOI22_prison)C++17
90 / 100
10 ms980 KiB
#include <bits/stdc++.h> std::vector <std::vector <int>> devise_strategy(int n) { std::vector <std::vector <int>> ans(22, std::vector <int> (n + 1)); auto f = [&] (auto&& self, int l, int r, int pl, int pr, int it, int bx, int pbx) -> void { if (l > r) { return; } int bag = it & 1; ans[it * 3 + bx][0] = bag; int bou1 = (l * 2 + r + 1) / 3; int bou2 = (r * 2 + l - 1) / 3; for (int i = pl; i <= pr; i++) { if (i >= l && i <= r) { ans[pbx][i] = it * 3 + bx; } if (i <= l || i >= r) { ans[it * 3 + bx][i] = i <= l ? ~bag : ~(1 ^ bag); } } if (l + 1 > r - 1) { return; } self(self, l + 1, bou1, l, r, it + 1, 1, it * 3 + bx); self(self, bou1 + 1, bou2, l, r, it + 1, 2, it * 3 + bx); self(self, bou2 + 1, r - 1, l, r, it + 1, 3, it * 3 + bx); }; f(f, 1, n, 1, n, -1, 3, 0); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...