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 = 28, POWSIZE = 10;
vector<vector<int>> wyn;
int POW[POWSIZE];
vector<vector<int>> devise_strategy(int N)
{
wyn.assign(MAXM+1,{});
rep(i,MAXM+1) wyn[i].assign(N+1,-1);
POW[0] = 1;
for(int i = 1; i < POWSIZE; ++i) POW[i] = POW[i-1] * 3;
wyn[0][0] = 0;
for(int i = 1; i <= N; ++i)
{
int b = 0;
if(POW[7]*2 <= i) b = 2;
else if (POW[7]*1 <= i) b = 1;
wyn[0][i] = 10*b+8;
}
for(int i = 1; i <= MAXM; ++i)
{
int bit_val = i / 10, bit_idx = i % 10;
bool czy_pochodzi_z_A = false;
if(bit_idx % 2 == 0) czy_pochodzi_z_A = true;
if(czy_pochodzi_z_A) wyn[i][0] = 1;
else wyn[i][0] = 0;
for(int j = 1; j <= N; ++j)
{
int b = 0;
if(POW[bit_idx-1]*2 <= j) b = 2;
else if (POW[bit_idx-1]*1 <= j) b = 1;
if(bit_val < b)
{
if(czy_pochodzi_z_A) wyn[i][j] = -1;
else wyn[i][j] = -2;
}
else if(bit_val > b)
{
if(czy_pochodzi_z_A) wyn[i][j] = -2;
else wyn[i][j] = -1;
}
else
{
b = 0;
if(POW[bit_idx-2]*2 <= j) b = 2;
else if (POW[bit_idx-2]*1 <= j) b = 1;
wyn[i][j] = b*10+(bit_idx-1);
}
}
}
/*
for (int i = 0; i <= MAXM; ++i)
{
for (int j = 0; j <= N; ++j) cout << wyn[i][j] << " ";
cout << endl;
}
*/
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... |