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>
using namespace std;
#include <vector>
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> v;
v.resize(3 * 8 + 1, vector<int> (N + 1));
int x = 2187, t = 1;
for(int i = 1; i <= N; i++) {
v[0][i] = i / x + 1;
}
for(int i = 1; i <= 24; i += 3) {
// i , i + 1, i + 3 --- eseni aris
for(int T = 0; T < 3; T++) {
// if(i + T == 24) continue;
v[i + T][0] = t;
for(int j = 1; j <= N; j++) {
if((j % (x * 3)) / x != T) {
v[i + T][j] = ((j % (x * 3)) / x < T ? -t - 1 : -(1 - t) - 1);
} else {
if(x > 1)
v[i + T][j] = i + 3 + ((j % x) / (x / 3));
//else if(x == 3 && j % 3 != 2) v[i + T][j] = -t - 1;
}
}
}
x /= 3; t ^= 1;
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |