제출 #828473

#제출 시각아이디문제언어결과실행 시간메모리
828473dxz05죄수들의 도전 (IOI22_prison)C++17
36.50 / 100
19 ms1620 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define bit(x, i) (((x) >> (i)) & 1) vector<vector<int>> devise_strategy(int N) { int X = 39; vector<vector<int>> s(X + 1, vector<int>(N + 1, 0)); s[0][0] = 0; for (int i = 1; i <= N; i++){ s[0][i] = 37; } for (int i = 1; i <= X; i++){ int b = (i - 1) / 3; int r = (i - 1) % 3; if (r == 0){ /// didn't open A s[i][0] = 0; for (int j = 1; j <= N; j++){ s[i][j] = b * 3 + 2 + bit(j, b); } } else if (r == 1){ /// opened A, bit was 0 s[i][0] = 1; for (int j = 1; j <= N; j++){ if (bit(j, b)){ s[i][j] = -1; } else { s[i][j] = (b - 1) * 3 + 1; } } } else if (r == 2){ /// opened A, was 1 s[i][0] = 1; for (int j = 1; j <= N; j++){ if (!bit(j, b)){ s[i][j] = -2; } else { s[i][j] = (b - 1) * 3 + 1; } } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...