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;
std::vector<std::vector<int>> devise_strategy(int n) {
int x = 34;
vector ans(x + 1, vector(n + 1, 0));
for (int i = 0; i <= x; i++) {
if (i % 5 == 0) {
ans[i][0] = 0;
for (int j = 1; j <= n; j++) {
ans[i][j] = i + 1;
int k = 13 - (i / 5) * 2;
if (j & (1 << k)) ans[i][j] += 2;
if (j & (1 << (k - 1))) ans[i][j] += 1;
}
continue;
}
ans[i][0] = 1;
int a = i % 5 - 1, k = 13 - (i / 5) * 2;
for (int j = 1; j <= n; j++) {
int b = 0;
if (j & (1 << k)) b += 2;
if (j & (1 << (k - 1))) b += 1;
if (a == b) {
ans[i][j] = i - i % 5 + 5;
if (ans[i][j] > x) ans[i][j] = 0;
continue;
}
ans[i][j] = (a > b ? -2 : -1);
}
}
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... |