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>
using namespace std;
using ll = long long;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 2137
#endif
const int LOG = 12;
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> a(40, vector<int>(n + 1));
for (int i = 0; i <= LOG; i++) {
a[i][0] = 0;
for (int j = 1; j <= n; j++) {
int b = (j >> (LOG - i)) & 1;
a[i][j] = 13 + 2 * i + b;
}
}
for (int i = 0; i <= LOG; i++) {
for (int p = 0; p < 2; p++) {
a[13 + 2 * i + p][0] = 1;
for (int j = 1; j <= n; j++) {
int q = (j >> (LOG - i)) & 1;
a[13 + 2 * i + p][j] = p == 1 && q == 0 ? -2 : (p == 0 && q == 1 ? -1 : i + 1);
}
}
}
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |