Submission #1321217

#TimeUsernameProblemLanguageResultExecution timeMemory
1321217d_k죄수들의 도전 (IOI22_prison)C++20
0 / 100
1 ms332 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int n) { n-=3; int b = 1; while ((1 << b) <= n) b++; int x = 3 * b - 1; vector<vector<int>> ans(x + 1, vector<int>(n + 1, 0)); for (int st = 0; st <= x; st++) { int s = st / 3; int t = st % 3; ans[st][0] = (t != 0); for (int v = 1; v <= n; v++) { int bit = (v >> (b - s - 1)) & 1; if (t == 0) { ans[st][v] = (st + 1) + bit; } else { int ab = t - 1; int bb = bit; if (ab < bb) ans[st][v] = -1; else if (ab > bb) ans[st][v] = -2; else { ans[st][v] = (s != b - 1) ? (3 * (s + 1)) : 0; } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...