Submission #1022846

#TimeUsernameProblemLanguageResultExecution timeMemory
1022846vjudge1Prisoner Challenge (IOI22_prison)C++17
47 / 100
13 ms1372 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; #define rall(s) s.rbegin(), s.rend() #define all(s) s.begin(), s.end() #define sz(s) (int)s.size() #define s second #define f first using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const int N = 1e6; vector<vector<int>> devise_strategy(int n) { int pw[8]; pw[0] = 1; for (int i = 1; i < 8; i++) pw[i] = pw[i - 1] * 3; vector<vector<int>> ans; for (int x = 0; x <= 32; x++) { if (!x) { vector<int> s = {0}; for (int i = 1; i <= n; i++) { int v = (i / pw[7]) % 3 + 1; s.push_back(7 * 4 + v + 1); } ans.push_back(s); continue; } int v = x - 1; if (v % 4) { vector<int> s = {1}; int b = v / 4, is = v % 4 - 1; for (int i = 1; i <= n; i++) { int y = (i / pw[b]) % 3; if (is < y) s.push_back(-1); else if (is > y) s.push_back(-2); else { if (!b) s.push_back(-1); else s.push_back((b - 1) * 4 + 1); } } ans.push_back(s); }else { vector<int> s = {0}; int b = v / 4; for (int i = 1; i <= n; i++) { int y = (i / pw[b]) % 3 + 1; s.push_back(b * 4 + y + 1); } ans.push_back(s); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...