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;
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>> res(25, vector<int>(N + 1, 0));
res[0][0] = 0;
for (int k = 1; k <= N; k++) {
res[0][k] = ((k >> 12) & 1) + 1;
}
for (int i = 12; i >= 1; i--) {
int off = (12 - i) * 2 + 1;
for (int j = 0; j < 2; j++) {
res[off + j][0] = (i & 1) ^ 1;
for (int k = 1; k <= N; k++) {
if (((k >> i) & 1) ^ j) {
res[off + j][k] = -1 - ((i & 1) ^ j);
}
else {
if (i > 1) {
res[off + j][k] = off + 2 + ((k >> (i - 1)) & 1);
}
else {
res[off + j][k] = -1 - ((i & 1) ^ ((k >> (i - 1)) & 1) ^ 1);
}
}
}
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |