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;
vector<vector<int>> devise_strategy(int N) {
vector<vector<int>> ans;
auto rec = [&](auto &&rec, int l, int r, bool fst) -> int {
int sz = ans.size();
ans.emplace_back(N + 1);
ans[sz][0] = fst;
int m = (l + r) / 2;
for (int i = 1; i <= N; i++) {
if (i <= l)
ans[sz][i] = fst ? -2 : -1;
else if (i >= r - 1)
ans[sz][i] = fst ? -1 : -2;
else if (i < m)
ans[sz][i] = rec(rec, l, m, !fst);
else
ans[sz][i] = rec(rec, m, r, !fst);
}
return sz;
};
rec(rec, 1, N + 1, true);
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... |