This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// In the name of Allah
#include <bits/stdc++.h>
#include "prison.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
#define len(x) ((ll) (x).size())
#define Mp make_pair
#define pb push_back
#define endl '\n'
#define sep ' '
int n;
vector<vector<int>> ans;
int get_num(int x, int T) {
while (T--) x /= 3;
return (x % 3);
}
vector<vector<int>> devise_strategy(int N) {
n = N; ans.resize(32);
for (int i = 0; i < 32; i++) {
ans[i].resize(n + 1);
for (int j = 0; j <= n; j++) {
int x = i % 4, r = i / 4;
int R = get_num(j, 7 - r) + 1;
if (x == 0) {
if (j == 0) ans[i][j] = 0;
else ans[i][j] = (r * 4) + R;
}
else {
if (j == 0) ans[i][j] = 1;
else if (x < R) ans[i][j] = -1;
else if (R < x) ans[i][j] = -2;
else ans[i][j] = ((r + 1) * 4);
}
if (j != 0 && ans[i][j] >= 32) ans[i][j] = -1;
}
}
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... |