Submission #1074061

#TimeUsernameProblemLanguageResultExecution timeMemory
1074061shmaxPrisoner Challenge (IOI22_prison)C++17
56 / 100
10 ms1160 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define bit(x, i) ((x >> (i)) & 1) const int C = 13; template<typename T> using vec = vector<T>; std::vector<std::vector<int>> devise_strategy(int N) { int x = 2 * C; vec<vec<int>> s(x + 1, vec<int>(N + 1)); for (int i = 0; i <= x; i++) { if (i == 0) { s[i][0] = 1; for (int j = 1; j <= N; j++) { s[i][j] = bit(j, C - 1) * C + C; } continue; } { int bit_pos = (i - 1) % C; bool is = i > C; s[i][0] = bit_pos % 2; for (int j = 1; j <= N; j++) { if (is and !bit(j, bit_pos)) { s[i][j] = -(s[i][0] + 1); } else if (!is and bit(j, bit_pos)) { s[i][j] = -((s[i][0] ^ 1) + 1); } else { s[i][j] = bit(j, bit_pos-1) * C + bit_pos; } } continue; } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...