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 <bits/stdc++.h>
#include "prison.h"
using namespace std;
typedef long long ll;
int n;
vector<vector<int>> devise_strategy(int N) {
n = N;
int x = 2*26;
vector<vector<int>> res(x+1, vector<int>(n+1));
for (int i = 0; i <= x; i++) {
res[i][0] = i&1;
for (int j = 1; j <= n; j++) {
bool b = (j >> (12-(i%26)/2)) & 1;
if ((i&1) && (b != i/26)) {
res[i][j] = b < i/26 ? -2 : -1;
continue;
}
res[i][j] = (i%26)+1 + 26*(!(i&1) && b);
if (res[i][j] > x) res[i][j] = 0;
}
}
return res;
}
#ifdef TEST
#include "grader.cpp"
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |