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