Submission #1029283

#TimeUsernameProblemLanguageResultExecution timeMemory
1029283AndreyPrisoner Challenge (IOI22_prison)C++17
10 / 100
5 ms936 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; int calc(int a, int x) { a/=8; for(int i = 0; i < 5-x; i++) { a/=3; } return a%3; } vector<vector<int>> devise_strategy(int n) { vector<vector<int>> ans(22,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 <= 18; i++) { int c = (i-1)/3+1; ans[i][0] = c%2; for(int j = 1; j <= n; j++) { if(calc(j,c) == (i-1)%3) { if(i >= 16) { if(j%8 == 0) { ans[i][j] = -1; } else if(j%8 == 7) { ans[i][j] = -2; } else { ans[i][j] = 19+((j%8)-1)/2; } } else { ans[i][j] = c*3+calc(j,c+1)+1; } } else { if(calc(j,c) < (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; } } } } } ans[19][0] = 1; ans[20][0] = 1; ans[21][0] = 1; for(int i = 1; i <= n; i++) { int x = i%8; if(x <= 1) { ans[19][i] = -2; } else if(x >= 2) { ans[19][i] = -1; } } for(int i = 1; i <= n; i++) { int x = i%8; if(x <= 3) { ans[20][i] = -2; } else if(x >= 4) { ans[20][i] = -1; } } for(int i = 1; i <= n; i++) { int x = i%8; if(x <= 5) { ans[21][i] = -2; } else if(x >= 6) { ans[21][i] = -1; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...