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;
using ll = long long;
using arr = array<int, 2>;
using arrr = array<int, 3>;
// Bruker tretalls systemet
std::vector<std::vector<int>> devise_strategy(int n) {
int x = 24, s = x + 1;
vector<vector<int>> output(s, vector<int>(n + 1));
// Open bag A
output[0][0] = 0;
for (int j = 1; j <= n; j++)
{
output[0][j] = 7 * 3 + 1 + (j / (int)pow(3, 7));
// cout << output[0][j] << "\n";
}
for (int y = 1; y <= 7; y++ )
{
for (int i = 1 + y * 3; i <= (y + 1) * 3; i++)
{
output[i][0] = (y & 1);
for (int j = 1; j <= n; j++)
{
if (y * 3 + 1 + ((j % (int)pow(3, y + 1)) / (int)pow(3, y)) == i)
{
output[i][j] = (y - 1) * 3 + 1 + ((j % (int)pow(3, y)) / (int)pow(3, y - 1));
} else if (i > y * 3 + 1 + ((j % (int)pow(3, y + 1)) / (int)pow(3, y)))
{
output[i][j] = -1 - (y & 1);
} else {
output[i][j] = -1 - ((y + 1) & 1);
}
}
}
}
for (int i = 1; i <= 3; i++)
{
output[i][0] = 1;
for (int j = 1; j <= n; j++)
{
if (j % 3 > i % 3)
{
output[i][j] = -1;
} else if (j % 3 < i % 3)
{
output[i][j] = -2;
} else {
output[i][j] = 0;
}
}
}
return output;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |