#include <iostream>
#include "vector"
#include <cassert>
#include <cstdio>
#include <string>
#include <vector>
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#define all(x) x.begin(), x.end()
using namespace std;
vector<array<int, 3>> names;
vector<vector<int>> devise_strategy(int N) {
names.assign(25, {});
names[0] = {0, 0, 0};
for (int i = 0; i < 24; ++i) {
names[i + 1] = {i / 2, i % 2, i / 2 % 2};
}
vector<vector<int>> res;
res.push_back(vector<int>(N + 1, 0));
res[0][0] = 1;
for (int i = 1; i <= N; ++i) {
res[0][i] = bitset<13>(i)[12-0] + 1;
}
int mx = 0;
for (int i = 1; i < 25; ++i) {
res.push_back(vector<int>(N + 1, 0));
res[i][0] = names[i][2];
for (int j = 1; j <= N; ++j) {
bitset<13> bt = j;
if (i > 2 and bt[12-names[i][0]] != names[i][1]) {
res[i][j] = -(names[i][2] ^ (bt[12-names[i][0]] > names[i][1]))-1;
} else {
if (12-(names[i][0] + 1) > 0)
res[i][j] = bitset<13>(j)[12-(names[i][0] + 1)] + names[i][0] * 2 + 3;
else
res[i][j] = -(bitset<13>(j)[12-(names[i][0] + 1)] ^ 1)-1;
}
mx = max(mx, res[i][j]);
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
372 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
2 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
3 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
4 |
Partially correct |
8 ms |
596 KB |
Output is partially correct |
5 |
Incorrect |
11 ms |
940 KB |
Strategy failed for N=4096, A=4090, B=4096 |
6 |
Halted |
0 ms |
0 KB |
- |