This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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) {
vector<vector<int>> ans;
for (int x = 0; x <= 39; x++) {
if (!x) {
vector<int> s = {0};
for (int i = 1; i <= n; i++) {
if (i >> 12 & 1) s.push_back(12 * 3 + 3);
else s.push_back(12 * 3 + 2);
}
ans.push_back(s);
continue;
}
int v = x - 1;
if (v % 3) {
vector<int> s = {1};
int b = v / 3, is = v % 3 - 1;
for (int i = 1; i <= n; i++) {
if (i >> b & 1) {
if (is && b) {
s.push_back((b - 1) * 3 + 1);
continue;
}
s.push_back(-1);
}else {
if (is || !b) {
s.push_back(-2);
continue;
}
s.push_back((b - 1) * 3 + 1);
}
}
ans.push_back(s);
}else {
vector<int> s = {0};
int b = v / 3;
for (int i = 1; i <= n; i++) {
if (i >> b & 1) s.push_back((b * 3) + 3);
else s.push_back(b * 3 + 2);
}
ans.push_back(s);
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |