이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
vector<std::vector<int>> devise_strategy(int N)
{
vector < vector < int > > strategy;
int maxnum = 26;
strategy.resize(maxnum + 1);
for (int i = 0; i <= maxnum; i ++)
strategy[i].resize(N + 1);
strategy[0][0] = 0;
for (int j = 1; j <= N; j ++)
{
if ((j & (1 << 12)))
strategy[0][j] = 13;
else
strategy[0][j] = 26;
}
for (int i = 1; i <= maxnum; i ++)
{
if (i <= 13)
{
int bit = i - 1;
if (bit % 2 == 0)
{
strategy[i][0] = 1;
for (int j = 1; j <= N; j ++)
{
if ((j & (1 << bit)) == 0)
strategy[i][j] = -2;
else
{
if ((j & (1 << (bit - 1))))
strategy[i][j] = bit;
else
strategy[i][j] = bit + 13;
}
}
}
else
{
strategy[i][0] = 0;
for (int j = 1; j <= N; j ++)
{
if ((j & (1 << bit)) == 0)
strategy[i][j] = -1;
else
{
if ((j & (1 << (bit - 1))))
strategy[i][j] = bit;
else
strategy[i][j] = bit + 13;
}
}
}
}
else
{
int bit = i - 14;
if (bit % 2 == 0)
{
strategy[i][0] = 1;
for (int j = 1; j <= N; j ++)
{
if ((j & (1 << bit)) > 0)
strategy[i][j] = -1;
else
{
if ((j & (1 << (bit - 1))))
strategy[i][j] = bit;
else
strategy[i][j] = bit + 13;
}
}
}
else
{
strategy[i][0] = 0;
for (int j = 1; j <= N; j ++)
{
if ((j & (1 << bit)) > 0)
strategy[i][j] = -2;
else
{
if ((j & (1 << (bit - 1))))
strategy[i][j] = bit;
else
strategy[i][j] = bit + 13;
}
}
}
}
}
/**for (int i = 0; i <= 26; i ++, cout << endl)
for (int j = 1; j <= N; j ++)
cout << strategy[i][j] << " ";
cout << endl;*/
return strategy;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |