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;
int Bit(int x, int i) {
return x >> i & 1;
}
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> s(25, vector<int>(N + 1, 0));
s[0][0] = 1;
for (int j = 1; j <= N; ++j)
s[0][j] = 12 + Bit(j, 12) * 12;
for (int i = 1; i <= 24; ++i) {
int pos = (i <= 12 ? i : i - 12);
int obit = i > 12;
s[i][0] = pos & 1;
for (int j = 1; j <= N; ++j) {
if (Bit(j, pos) != obit) {
if (obit == 0)
s[i][j] = (pos & 1) ? -1 : -2;
else
s[i][j] = (pos & 1) ? -2 : -1;
}
else {
if (pos == 1)
s[i][j] = (j & 1) ? -1 : -2;
else
s[i][j] = pos - 1 + Bit(j, pos - 1) * 12;
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |