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;
typedef long long ll;
typedef long double ld;
#define rep(a,b) for (int a = 0; a < (b); ++a)
#define pb push_back
#define all(t) t.begin(), t.end()
const int MAXM = 52;
vector<vector<int>> wyn;
vector<vector<int>> devise_strategy(int N)
{
wyn.assign(MAXM+1,{});
rep(i,MAXM+1) wyn[i].assign(N+1,-1);
wyn[0][0] = 0;
for(int i = 1; i <= N; ++i)
{
if(i % 2 == 0) wyn[0][i] = 1;
else wyn[0][i] = 14;
}
for(int i = 1; i <= MAXM; ++i)
{
int idx = i;
bool czy_pochodzi_z_A = true, czy_zapalony_bit = false;
if(idx > 26)
{
czy_pochodzi_z_A = false, idx -= 26;
}
if(idx > 13)
{
czy_zapalony_bit = true, idx -= 13;
}
if(czy_pochodzi_z_A) wyn[i][0] = 1;
else wyn[i][0] = 0;
for(int j = 1; j <= N; ++j)
{
auto b = (1 << (idx-1)) & j;
if(czy_zapalony_bit and !b)
{
if(czy_pochodzi_z_A) wyn[i][j] = -1;
else wyn[i][j] = -2;
}
else if(!czy_zapalony_bit and b)
{
if(czy_pochodzi_z_A) wyn[i][j] = -2;
else wyn[i][j] = -1;
}
else
{
int val = idx+1;
if(czy_pochodzi_z_A) val += 26;
auto bit_spr = (1 << idx) & j;
if(bit_spr) val += 13;
wyn[i][j] = val;
}
}
}
return wyn;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |