Submission #1179466

#TimeUsernameProblemLanguageResultExecution timeMemory
1179466gyg죄수들의 도전 (IOI22_prison)C++20
60 / 100
7 ms1096 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define vec vector bool on(int x, int i) { assert(i >= 0); return x & (1 << i); } vec<vec<int>> devise_strategy(int n) { int k = 25; vec<vec<int>> ans(k + 1, vec<int>(n + 1, 0)); for (int i = 0; i <= k; i++) { int b = 13 - (i + 1) / 2; if (i % 4 == 0 || i % 4 == 3) { ans[i][0] = 0; for (int j = 1; j <= n; j++) { int x = on(j, b); int y = (i % 2 == 0); if (i != 0 && x && !y) { ans[i][j] = -2; } else if (i != 0 && y && !x) { ans[i][j] = -1; } else if (b == 0) { ans[i][j] = 0; } else { int z = on(j, b - 1); ans[i][j] = i + ((i % 2 == 0) ? 0 : 1) + 1 + z; if (ans[i][j] == 26) ans[i][j] = -2; } } } else { ans[i][0] = 1; for (int j = 1; j <= n; j++) { int x = on(j, b); int y = (i % 2 == 0); if (i != 0 && x && !y) { ans[i][j] = -1; } else if (i != 0 && y && !x) { ans[i][j] = -2; } else if (b == 0) { ans[i][j] = 0; } else { int z = on(j, b - 1); ans[i][j] = i + ((i % 2 == 0) ? 0 : 1) + 1 + z; } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...