# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
836124 | tengiz05 | Prisoner Challenge (IOI22_prison) | C++17 | 23 ms | 2004 KiB |
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>> f(13 * 4, vector<int>(n + 1));
for (int i = 0; i < 13 * 4; i++) {
int num = 12 - (i >> 2);
int A = i & 1;
int res = i >> 1 & 1;
if (A == 0) {
f[i][0] = 0;
for (int j = 1; j <= n; j++) {
int bit = j >> num & 1;
f[i][j] = ((12 - num) << 2) | (bit << 1) | 1;
}
}
if (A == 1) {
f[i][0] = 1;
for (int j = 1; j <= n; j++) {
int bit = j >> num & 1;
if (bit == res) {
f[i][j] = (12 - num + 1) << 2;
} else {
if (res < bit) {
f[i][j] = -1;
} else {
f[i][j] = -2;
}
}
}
}
}
for (int i = 0; i < f.size(); i++) {
for (int j = 0; j <= n; j++) {
if (f[i][j] >= 13 * 4) f[i][j] = 0;
// cout << f[i][j] << " \n"[j == n];
}
}
return f;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |