제출 #625435

#제출 시각아이디문제언어결과실행 시간메모리
625435model_code죄수들의 도전 (IOI22_prison)C++17
100 / 100
11 ms1364 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> ans; void dnc(int P,int A,int B,int LL,int RR, int L,int R) { for (int i = L; i <= R; i++) ans[P][i] = A*3+B; for (int i = LL; i <= L; i++) ans[A*3+B][i] = -1 - ans[A*3+B][0]; for (int i = R; i <= RR; i++) ans[A*3+B][i] = -2 + ans[A*3+B][0]; L++; R--; if (R - L < 0) return; if (R - L < 2) { dnc(A*3+B, A+1, 1, L-1, R+1, L, R); return; } if (R - L < 4) { dnc(A*3+B, A+1, 1, L-1, R+1, L, (L+R)/2); dnc(A*3+B, A+1, 2, L-1, R+1, (L+R)/2+1, R); return; } dnc(A*3+B, A+1, 1, L-1, R+1, L, (L+L+R)/3); dnc(A*3+B, A+1, 2, L-1, R+1, (L+L+R)/3+1, (L+R+R)/3); dnc(A*3+B, A+1, 3, L-1, R+1, (L+R+R)/3+1, R); } vector<vector<int>> devise_strategy(int N) { for (int i = 0; i <= 20; i++) { ans.push_back(vector<int>(N+1,0)); if ((i + 2) % 6 < 3) ans[i][0] = 1; } dnc(0, -1, 3, 1, N, 1, N); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...