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 <vector>
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "/home/eagle/ioi22/debug.h"
#else
#define debug(...) void(37)
#endif
std::vector<std::vector<int>> devise_strategy(int N) {
int M = 24;
const int BIT = 12;
vector<vector<int>> S(M + 1, vector<int>(N + 1));
S[0][0] = 0;
for (int i = 1; i <= N; ++i) {
S[0][i] = 1 + (i >= (1 << BIT));
}
debug(S[0]);
for (int i = 1; i <= M; ++i) {
int bit = (1 + BIT - (i + 1) / 2);
S[i][0] = bit % 2;
bool val = (i + 1) % 2;
debug(i, bit, val);
for (int j = 1; j <= N; ++j) {
int my_val = (j >> bit) & 1;
if (my_val != val) {
S[i][j] = ((S[i][0] ^ (my_val < val)) ? -1 : -2);
continue;
}
if (bit == 1) {
S[i][j] = (((j % 2 == 0) ^ S[i][0]) ? -1 : -2);
continue;
}
S[i][j] = 3 + 2 * (BIT - bit) + ((j >> (bit - 1)) % 2);
}
debug(S[i]);
}
debug(S);
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... |