제출 #660769

#제출 시각아이디문제언어결과실행 시간메모리
660769mychecksedad죄수들의 도전 (IOI22_prison)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; int k = 3, p[9]; std::vector<std::vector<int>> devise_strategy(int n){ p[0] = 1; for(int i = 1; i <= 8; ++i) p[i] = p[i - 1] * 3; vector<vector<int>> v(25); for(int i = 0; i <= 24; ++i) v[i].resize(n+1); v[0][0] = 0; for(int i = 1; i <= 24; ++i) v[i][0] = (((i-1)/3)%2 ? 0 : 1); for(int i = 1; i <= n; ++i){ v[0][i] = (i / p[8]) + 1; } for(int i = 1; i <= 24; ++i){ for(int j = 1; j <= n; ++j){ int x = (i - 1) / 3; int val = (i - 1) % 3; int d = j % p[8 - x]; int divisor = p[8 - x - 1]; if(x % 2){ if(d / divisor != val){ v[i][j] = (d / divisor < val ? -2 : -1); }else{ v[i][j] = d / divisor + (x * 3 + 4); } }else{ if(d / divisor != val){ v[i][j] = (d / divisor < val ? -1 : -2); }else{ v[i][j] = d / divisor + (x * 3 + 4); } } } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...