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"
/*
author: aykhn
4/21/2023
*/
using namespace std;
typedef long long ll;
#define OPT ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout<<endl;
vector<vector<int>> devise_strategy(int n)
{
vector<vector<int>> s(50, vector<int> (n + 1, 0));
s[0][0] = 0;
for (int i = 1; i <= n; i++) s[0][i] = 40 + i/1000;
for (int i = 40; i <= 49; i++)
{
s[i][0] = 1;
for (int j = 1; j <= n; j++)
{
if (j/1000 < i%10) s[i][j] = -2;
else if (j/1000 > i%10) s[i][j] = -1;
else s[i][j] = 30 + j/100%10;
}
}
for (int i = 30; i <= 39; i++)
{
s[i][0] = 0;
for (int j = 1; j <= n; j++)
{
if (j/100%10 < i%10) s[i][j] = -1;
else if (j/100%10 > i%10) s[i][j] = -2;
else s[i][j] = 20 + j/10%10;
}
}
for (int i = 20; i <= 29; i++)
{
s[i][0] = 1;
for (int j = 1; j <= n; j++)
{
if (j/10%10 < i%10) s[i][j] = -2;
else if (j/10%10 > i%10) s[i][j] = -1;
else s[i][j] = 10 + j%10;
}
}
for (int i = 10; i <= 19; i++)
{
s[i][0] = 0;
for (int j = 1; j <= n; j++)
{
if (j%10 < i%10) s[i][j] = -1;
else if (j%10 > i%10) s[i][j] = -2;
else s[i][j] = j%10;
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |