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 pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define mk make_pair
#define fr first
#define second
vector<vector<int>> devise_strategy(int N) {
// 1, 2, 3 -> se refere ao digito 7
// 4, 5, 6 -> se refere ao digito 1
int x = 23;
vector<vector<int>> s(x+1);
vector<int> pot(10, 1);
for(int i = 1; i < 10; i++) pot[i] = pot[i-1]*3;
for(int i = 0; i <= x; i++) {
s[i].resize(N+1);
int exp = (i-1)/3;
if(i == 0) exp--;
s[i][0] = (exp+1)%2;
exp = 7-exp;
for(int j = 1; j <= N; j++) {
// tava escrito o número i e eu vi a bolsa e tá escrito o número j
int d1 = (i-1)%3;
int d2 = (j/pot[exp])%3;
if((d1 == d2 or exp == 8) and exp != 0) s[i][j] = (8-exp)*3 + 1 + (j/pot[exp-1])%3;
else if(d1 > d2) s[i][j] = -1 - s[i][0];
else if(d2 > d1) s[i][j] = -2 + s[i][0];
if(s[i][j] == 24) s[i][j] = -2 + s[i][0];
}
}
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... |