제출 #831805

#제출 시각아이디문제언어결과실행 시간메모리
831805NeroZein죄수들의 도전 (IOI22_prison)C++17
56 / 100
11 ms1192 KiB
#include "prison.h" #include "bits/stdc++.h" using namespace std; const int M = 13; bool check(int x, int k) { k--; return (x >> k & 1); } vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ret(M * 2 + 1, vector<int>(N + 1)); ret[0][0] = 0; for (int i = 1; i <= N; ++i) { ret[0][i] = M + M * check(i, M); } for (int i = 1; i <= M * 2; ++i) { int bit = i - (i > M ? M : 0); bool off = i <= M; if (bit % 2) {//we have the state of A ret[i][0] = 1; for (int j = 1; j <= N; ++j) { if (off && check(j, bit)) { ret[i][j] = -1; } else if (!off && !check(j, bit)) { ret[i][j] = -2; } else { if (bit) { ret[i][j] = bit - 1 + M * check(j, bit - 1); } } } } else { ret[i][0] = 0; for (int j = 1; j <= N; ++j) { if (off && check(j, bit)) { ret[i][j] = -2; } else if (!off && !check(j, bit)) { ret[i][j] = -1; } else { if (bit) { ret[i][j] = bit - 1 + M * check(j, bit - 1); } } } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...