Submission #876345

#TimeUsernameProblemLanguageResultExecution timeMemory
876345AndreyPrisoner Challenge (IOI22_prison)C++17
48.50 / 100
12 ms1516 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; int calc(int a, int b) { for(int i = 0; i < b; i++) { a/=3; } return a%3; } std::vector<std::vector<int>> devise_strategy(int n) { vector<vector<int>> ans(0); for(int i = 0; i < 32; i++) { ans.push_back(vector<int> (n+1)); } for(int i = 0; i < 32; i++) { if(i%4 == 0) { ans[i][0] = 0; } else { ans[i][0] = 1; } int d = 7-(i/4); for(int j = 1; j <= n; j++) { if(i%4 == 0) { ans[i][j] = i+1; ans[i][j]+=calc(j,d); } else { int x = calc(j,d),y = (i%4)-1; if(x == y) { ans[i][j] = min(31,i-(i%4)+4); } else if(x < y) { ans[i][j] = -2; } else { ans[i][j] = -1; } } } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...