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 <vector>
#include <bits/stdc++.h>
using namespace std;
#define f0(i, n) for(int i = 0; i < (n); i++)
#define f1(i, n) for(int i = 1; i <= (n); i++)
#define pb push_back
#define ff first
#define ss second
typedef vector<int> vi;
std::vector<std::vector<int>> devise_strategy(int N) {
int x = 32;
vi init(N+1, 0);
std::vector<std::vector<int>> s(x, init);
f0(i, 32) {
int dig = i / 4;
if(i % 4 == 0) {
s[i][0] = 0;
f1(j, N) {
int d = 7 - dig, nn = j;
while (d--) nn /= 3;
s[i][j] = (i + (nn % 3) + 1);
// cout << s[i][j] << " ";
}
// cout << endl;
} else {
s[i][0] = 1;
f1(j, N) {
int d = 7 - dig, nn = j;
while (d--) nn /= 3;
if( ((nn % 3) + 1) > ((i % 4)) ) {
s[i][j] = -1;
} else if( ((nn % 3) + 1) < ((i % 4)) ) {
s[i][j] = -2;
} else {
s[i][j] = ((dig + 1)*4) % 32;
}
// cout << s[i][j] << " ";
}
// cout << endl;
}
}
return s;
return {std::vector<int>(N + 1, 0)};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |