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"
using namespace std;
#define pb push_back
#define ll long long
#define fi first
#define se second
std::vector<std::vector<int>> devise_strategy(int N) {
vector<vector<int>> tab(29,vector<int> (N+1,0));
int n=N;
tab[0][0]=tab[27][0]=tab[28][0]=0;
for (int i = 1; i < n+1; ++i)
{
tab[0][i]=20+i/100;
if(tab[0][i]==20) tab[0][i]=26;
tab[27][i]=(i%100)/10;
if(tab[27][i]==0) tab[27][i]=10;
tab[28][i]=10+(i%10);
if(tab[28][i]==10) tab[28][i]=20;
}
for (int i = 21; i <= 26; ++i)
{
int cur=i%10;
if(cur==6) cur=0;
tab[i][0]=1;
for (int j = 1; j < n+1; ++j)
{
if(j/100>cur) tab[i][j]=-1;
else if(j/100<cur) tab[i][j]=-2;
else tab[i][j]=27;
}
}
for (int i = 1; i <= 10; ++i)
{
tab[i][0]=1;
for (int j = 1; j < n+1; ++j)
{
if((j%100)/10>i%10) tab[i][j]=-1;
else if((j%100)<i%10) tab[i][j]=-2;
else tab[i][j]=28;
}
}
for (int i = 11; i <= 20; ++i)
{
tab[i][0]=1;
for (int j = 1; j < n+1; ++j)
{
if(j%10>i%10) tab[i][j]=-1;
else if(j%10<i%10) tab[i][j]=-2;
else tab[i][j]=28;
}
}
return tab;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |