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>> devise_strategy(int N)
{
vector<vector<int>> p(13 * 3 - 2, vector<int>(N+1, 1));
int bit = 13;
for (int i = 0; i < 13 * 3 - 2; i++)
{
if (i % 3 == 0)
{
p[i][0] = 0;
bit--;
for (int j = 1; j <= N; j++)
{
if (j & (1 << bit))
p[i][j] = i + 2;
else
p[i][j] = i + 1;
}
}
else if (i % 3 == 1)
{
for (int j = 1; j <= N; j++)
{
if (j & (1 << bit))
p[i][j] = -1;
else
p[i][j] = i + 2;
}
}
else
{
for (int j = 1; j <= N; j++)
{
if (j & (1 << bit))
p[i][j] = i + 1;
else
p[i][j] = -2;
}
}
}
for (int i = 1; i <= N; i++)
{
if (p.back()[i] == 37)
p.back()[i] = -1;
else
p.back()[i] = -2;
}
return p;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |