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>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)
#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)
using namespace std;
using ll = long long;
template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }
std::vector<std::vector<int>> devise_strategy(int N) {
vector<int> TH(10);
TH[0] = 1;
rep (i, 9) TH[i + 1] = TH[i] * 3;
vector<vector<int>> res(25, vector<int>(N + 1));
res[0][0] = 0;
rep2 (i, 1, N + 1) res[0][i] = i / TH[7] % 3 + 1;
rep (i, 8) rep (j, 3) {
res[i * 3 + 1 + j][0] = (i + 1) % 2;
rep2 (k, 1, N + 1) {
if (k / TH[7 - i] % 3 < j) res[i * 3 + 1 + j][k] = -1 - (i + 1) % 2;
else if (k / TH[7 - i] % 3 > j) res[i * 3 + 1 + j][k] = -1 - i % 2;
else if (i != 7) res[i * 3 + 1 + j][k] = (i + 1) * 3 + 1 + k / TH[6 - i] % 3;
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |