제출 #1029294

#제출 시각아이디문제언어결과실행 시간메모리
1029294Andrey죄수들의 도전 (IOI22_prison)C++17
0 / 100
0 ms348 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; int calc(int a, int x) { a--; int r = 4999; x++; for(int i = 0; i <= x; i++) { if(a == 0) { return -1; } else if(a == r) { return 3; } if(i != x) { r = ((r-1)/3); a%=r; } } return a/r; } vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans(21,vector<int> (n+1)); ans[0][0] = 0; for(int i = 1; i <= n; i++) { ans[0][i] = calc(i,0)+1; } for(int i = 1; i <= 20; i++) { int c = (i-1)/3+1; ans[i][0] = c%2; for(int j = 1; j <= n; j++) { if(calc(j,c-1) == (i-1)%3) { ans[i][j] = c*3+calc(j,c)+1; } else { if(calc(j,c-1) < (i-1)%3) { if(c%2) { ans[i][j] = -2; } else { ans[i][j] = -1; } } else { if(c%2) { ans[i][j] = -1; } else { ans[i][j] = -2; } } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...