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>> ans(27, vector<int> (n+1, 0));
for (int i = 1; i <= n; ++i)
{
if (i>=4096) ans[0][i]=13;
else ans[0][i]=26;
}
for (int i = 1; i < 27; ++i)
{
int x, iact=i-1;
if (iact<13)
{
if (iact%2) {
ans[i][0]=0;
x=-1;
} else {
ans[i][0]=1;
x=-2;
}
for (int j = 1; j <= n; ++j)
{
if (j & (int)pow(2, iact)) {
if ((j & (int)pow(2, iact - 1))) {
ans[i][j] = iact;
}
else {
ans[i][j] = iact+13;
}
}
else {
ans[i][j]=x;
}
}
}
else {
iact-=13;
if (iact%2) {
ans[i][0]=0;
x=-2;
} else {
ans[i][0]=1;
x=-1;
}
for (int j = 1; j <= n; ++j)
{
if (j & (int)pow(2, iact)) {
ans[i][j]=x;
}
else {
if (j & (int)pow(2, iact - 1)) {
ans[i][j] = iact;
}
else {
ans[i][j] = iact+13;
}
}
}
}
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |