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;
vector<vector<int>> erg;
void fill(int s, int e, int o, int d, bool bagB) {
erg[o][0] = bagB;
if (s >= e) return;
int pickThis = -1 - bagB;
int pickOther = -2 + bagB;
erg[o][s] = pickThis;
erg[o][e] = pickOther;
for (int i = 1; i <= 3; i++)
{
erg[d * 3 + i][s] = pickOther;
erg[d * 3 + i][e] = pickThis;
}
int t0 = s + 1;
int t3 = e;
int t1 = (t0 + t0 + t3) / 3;
int t2 = (t0 + t3 + t3) / 3;
for (int i = t0; i < t1; i++)
{
erg[o][i] = d * 3 + 1;
}
for (int i = t1; i < t3; i++)
{
erg[d * 3 + 1][i] = pickThis;
}
for (int i = t0; i < t1; i++)
{
erg[d * 3 + 2][i] = pickOther;
}
for (int i = t1; i < t2; i++)
{
erg[o][i] = d * 3 + 2;
}
for (int i = t2; i < t3; i++)
{
erg[d * 3 + 2][i] = pickThis;
}
for (int i = t0; i < t2; i++)
{
erg[d * 3 + 3][i] = pickOther;
}
for (int i = t2; i < t3; i++)
{
erg[o][i] = d * 3 + 3;
}
fill(t0, t1 - 1, d * 3 + 1, d + 1, !bagB);
fill(t1, t2 - 1, d * 3 + 2, d + 1, !bagB);
fill(t2, t3 - 1, d * 3 + 3, d + 1, !bagB);
}
vector<vector<int>> devise_strategy(int N) {
erg = vector<vector<int>>(22, vector<int>(N + 1));
fill(1, N, 0, 0, true);
return erg;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |