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 <bits/stdc++.h>
#include "prison.h"
//#define DEBUGGING
using namespace std;
constexpr static int x = 23;
void __print(int i) { cerr << i; }
template<typename T>
void __print(T& t) { cerr << "{"; int f = 0; for (auto& i : t) { cerr << (f++ ? ", " : ""); __print(i); } cerr << "}"; }
void _print() { cerr << "]\n"; }
template<typename T, typename... V>
void _print(T t, V... v) { __print(t); if (sizeof...(v)) cerr << ", "; _print(v...); }
#ifdef DEBUGGING
#define debug(x...) { cerr << "[" << (#x) << "] = ["; _print(x); }
#else
#define debug(x...)
#endif
vector<vector<int>> devise_strategy(int n)
{
vector<vector<int>> res = vector<vector<int>>(x+1, vector<int>(n+1));
for (int i = x; i > 0; i--)
{
int bit = 1 + (i / 2);
res[i][0] = (bit&1)^1;
for (int j = 1; j <= n; j++)
{
if (((j>>bit)&1) == (i&1))
{
if (bit > 2)
res[i][j] = (bit-2) * 2 + ((j>>(bit-1))&1);
else if ((j&3) == 3)
res[i][j] = res[i][0] - 2;
else if ((j&3) == 0)
res[i][j] = - 1 - res[i][0];
else
res[i][j] = 1;
}
else if ((j>>bit)&1)
{
res[i][j] = res[i][0] - 2;
}
else
{
res[i][j] = - 1 - res[i][0];
}
}
}
res[0][0] = 0;
for (int i = 1; i <= n; i++)
res[0][i] = 22 + ((i>>12)&1);
res[1][0] = 0;
for (int i = 1; i <= n; i++)
{
int j = i&3;
if (j > 1)
res[1][i] = -2;
else
res[1][i] = -1;
}
debug(res);
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |