Submission #640868

#TimeUsernameProblemLanguageResultExecution timeMemory
6408681zaid1Prisoner Challenge (IOI22_prison)C++17
65 / 100
13 ms1108 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int n) { vector<int> p={1}; for (int i = 0; i < 25; i++) p.push_back(p.back()*3); vector<vector<int>> v(25, vector<int>(n+1, 0)); for (int i = 0; i < 25; i++) { if (i) v[i][0] = !(((i+2)/3)%2); for (int j = 1; j <= n; j++) { if (i) { int d = (j/p[(i+2)/3-1])%3; if (d > (3-i%3)%3) v[i][j] = -1-!v[i][0]; else if (d < (3-i%3)%3) v[i][j] = -1-(v[i][0]); else if ((i+2)/3-2 >=0) v[i][j] = ((i+2)/3-1)*3 - (j/p[(i+2)/3-2])%3; } else { v[i][j] = 8*3-(j/p[7])%3; } } } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...