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;
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> v(27);
for (int i = 0; i < 27; i++)
{
if (i == 0)
{
v[i].push_back(0);
for (int j = 1; j <= N; j++)
{
int v1 = 0;
if (j & (1 << 12))
{
v1 = 1;
}
v[i].push_back(1 + v1);
}
continue;
}
if (i <= 2)
{
v[i].push_back(1);
for (int j = 1; j <= N; j++)
{
int v1 = 0, v2 = 0;
if (i == 2)
{
v1 = 1;
}
if (j & (1 << 12))
{
v2 = 1;
}
if (v1 == v2)
{
v2 = 0;
if (j & (1 << 11))
{
v2 = 1;
}
v[i].push_back(3 + v2);
}
else
{
if (v1 > v2)
{
v[i].push_back(-2);
}
else
{
v[i].push_back(-1);
}
}
}
continue;
}
int k = i;
if (i % 2 == 0)
{
k--;
}
if ((k / 2) % 2 == 0)
{
v[i].push_back(1);
for (int j = 1; j <= N; j++)
{
int v1 = i - k, v2 = 0;
if (j & (1 << (12 - (k / 2))))
{
v2 = 1;
}
if (v1 == v2)
{
v2 = 0;
if (j & (1 << (12 - (k / 2 + 1))))
{
v2 = 1;
}
v[i].push_back(min(k + 2 + v2, 26));
}
else
{
if (v1 > v2)
{
v[i].push_back(-2);
}
else
{
v[i].push_back(-1);
}
}
}
}
else
{
v[i].push_back(0);
for (int j = 1; j <= N; j++)
{
int v1 = i - k, v2 = 0;
if (j & (1 << (12 - (k / 2))))
{
v2 = 1;
}
if (v1 == v2)
{
v2 = 0;
if (j & (1 << (12 - (k / 2 + 1))))
{
v2 = 1;
}
v[i].push_back(min(k + 2 + v2, 26));
}
else
{
if (v1 < v2)
{
v[i].push_back(-2);
}
else
{
v[i].push_back(-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... |