# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1073700 | fv3 | Radio Towers (IOI22_towers) | C++17 | 0 ms | 0 KiB |
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 * 2 - 1, vector<int>(N+1, 1));
int bit = 12;
p[0][0] = 0;
for (int j = 1; j <= N; j++)
{
if (j & (1 << bit))
p[0][j] = 1;
else
p[0][j] = 2;
}
for (int i = 1; i < 13 * 2 - 1; i++)
{
bool A = ((i - 1) / 2) % 2;
if (A)
p[i][0] = 0;
if (i % 2)
{
bit--;
for (int j = 1; j <= N; j++)
{
if (j & (1 << (bit + 1)))
p[i][j] = A ? -1 : -2;
else if (j & (1 << (bit + 1)))
p[i][j] = i + 2;
else
p[i][j] = i + 3;
}
}
else
{
for (int j = 1; j <= N; j++)
{
if (j & (1 << (bit + 1)) == 0)
p[i][j] = A ? -2 : -1;
else if (j & (1 << bit))
p[i][j] = i + 2;
else
p[i][j] = i + 1;
}
}
}
for (auto&n : p[24])
{
if (n == 25) n = -1;
else n = -2;
}
for (auto&n : p[23])
{
if (n == 25) n = -1;
else n = -2;
}
p[23][0] = 0;
p[24][0] = 0;
return p;
}