#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll int, ll int>
#define ff first
#define ss second
#define pb push_back
vector<vector<int>> devise_strategy(int n) {
vector<vector<int>> ret;
const vector<int> go5 = {1, 5, 25, 125, 625, 3125, 15625};
int x = 35;
ret.resize(x + 1);
for (int i = 0; i <= x; i++) ret[i].resize(n + 1);
// write 0
ret[0][0] = 0;
for (int i = 1; i <= n; i++) {
ret[0][i] = 25 + (i / go5[5]) + 1;
}
// write 1-30
for (int i = 1; i <= 30; i++) {
int bitpos = (i - 1) / 5, bitval = (i - 1) % 5;
ret[i][0] = 1;
for (int j = 1; j <= n; j++) {
int retval = j % go5[bitpos + 1] / go5[bitpos];
if (bitval < retval) ret[i][j] = -1;
else if (bitval > retval) ret[i][j] = -2;
else ret[i][j] = 30 + bitpos;
}
}
// write 31-35
for (int i = 31; i <= 35; i++) {
int bitpos = (i - 31);
ret[i][0] = 0;
for (int j = 1; j <= n; j++) {
ret[i][j] = bitpos * 5 + (j % go5[bitpos + 1] / go5[bitpos]) + 1;
}
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
2 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
4 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
4 |
Partially correct |
10 ms |
792 KB |
Output is partially correct |
5 |
Partially correct |
26 ms |
1236 KB |
Output is partially correct |
6 |
Partially correct |
21 ms |
1412 KB |
Output is partially correct |
7 |
Partially correct |
23 ms |
1532 KB |
Output is partially correct |
8 |
Partially correct |
1 ms |
212 KB |
Output is partially correct |
9 |
Partially correct |
2 ms |
340 KB |
Output is partially correct |
10 |
Partially correct |
4 ms |
468 KB |
Output is partially correct |
11 |
Partially correct |
8 ms |
724 KB |
Output is partially correct |
12 |
Partially correct |
16 ms |
1236 KB |
Output is partially correct |