이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = 0; 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)
{
if (y != 0)
{
output[i][j] = (y - 1) * 3 + 1 + ((j % (int)pow(3, y)) / (int)pow(3, y - 1));
} else {
output[i][j] = 0;
}
} 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] = -2;
// } else if (j % 3 < i % 3)
// {
// output[i][j] = -1;
// } 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... |