제출 #831977

#제출 시각아이디문제언어결과실행 시간메모리
831977dxz05죄수들의 도전 (IOI22_prison)C++17
10 / 100
6 ms596 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; int get(int num, int pos, int base){ while (pos--) num /= base; return num % base; } vector<vector<int>> devise_strategy(int N) { const int base = 3; const int _log = 7; const int X = base * (_log + 1); vector<vector<int>> s(X + 1, vector<int>(N + 1, 0)); s[0][0] = 1; for (int i = 1; i <= N; i++){ s[0][i] = _log * base + 1 + get(i, _log, base); } for (int i = 1; i <= X; i++){ int b = (i - 1) / base; int r = (i - 1) % base; int bag = b % 2; s[i][0] = bag; for (int j = 1; j <= N; j++){ int d = get(j, b, base); if (d < r){ s[i][j] = (bag == 0 ? -1 : -2); } else if (d > r){ s[i][j] = (bag == 0 ? -2 : -1); } else if (b > 0){ int pd = get(j, b - 1, base); s[i][j] = (b - 1) * base + 1 + pd; } } } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...