Submission #824918

#TimeUsernameProblemLanguageResultExecution timeMemory
824918LittleCubePrisoner Challenge (IOI22_prison)C++17
65 / 100
10 ms1252 KiB
#include "prison.h" #include <bits/stdc++.h> #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define F first #define S second using namespace std; const int B = 3, P = 8, x = 24; int b[P + 2]; vector<vector<int>> devise_strategy(int N) { b[0] = b[1] = 1; for (int i = 2; i <= P + 1; i++) b[i] = b[i - 1] * B; vector<vector<int>> sol(x + 1); int idx = -2, bag = 1; for (int i = P + 1; i >= 1; i--, idx += 3, bag ^= 3) { for (int j = max(0, idx); j < idx + 3; j++) { int bit = (3 - j % 3) % 3; sol[j].emplace_back(bag - 1); for (int k = 1; k <= N; k++) { int cur = k / b[i] % 3, nxt = k / b[i - 1] % 3; if (i == 1) { if (cur < bit) sol[j].emplace_back(-bag); else sol[j].emplace_back(-(bag ^ 3)); } else { if (cur < bit) sol[j].emplace_back(-bag); else if(cur == bit) sol[j].emplace_back(idx + 5 - nxt); else sol[j].emplace_back(-(bag ^ 3)); } } } } return sol; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...