#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
void create_circuit(int M, vector <int> a) {
int N = a.size(), offset = 1;
while (offset <= N)
offset *= 2;
int curr = 1, cnt = 0;
vector <int> state(offset);
vector <int> pos(offset);
while (cnt < offset)
if (curr < offset) {
int nxt = 2 * curr + state[curr];
state[curr] ^= 1;
curr = nxt;
}
else {
pos[curr - offset] = cnt++;
curr = 1;
}
vector <int> x(offset - 1), y(offset - 1);
for (int i = 1; i < offset; i++) {
auto get_next = [&](int node) {
if (node < offset)
return -node;
node = pos[node - offset];
if (node < N)
return a[node];
return node == offset - 1 ? 0 : -1;
};
x[i - 1] = get_next(2 * i);
y[i - 1] = get_next(2 * i + 1);
}
answer(vector <int> (M + 1, -1), x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
224 KB |
Output is partially correct |
2 |
Partially correct |
85 ms |
10456 KB |
Output is partially correct |
3 |
Partially correct |
94 ms |
10452 KB |
Output is partially correct |
4 |
Partially correct |
110 ms |
11440 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
224 KB |
Output is partially correct |
2 |
Partially correct |
85 ms |
10456 KB |
Output is partially correct |
3 |
Partially correct |
94 ms |
10452 KB |
Output is partially correct |
4 |
Partially correct |
110 ms |
11440 KB |
Output is partially correct |
5 |
Partially correct |
111 ms |
11796 KB |
Output is partially correct |
6 |
Partially correct |
96 ms |
11632 KB |
Output is partially correct |
7 |
Partially correct |
97 ms |
11788 KB |
Output is partially correct |
8 |
Partially correct |
107 ms |
11564 KB |
Output is partially correct |
9 |
Partially correct |
89 ms |
10464 KB |
Output is partially correct |
10 |
Partially correct |
121 ms |
11556 KB |
Output is partially correct |
11 |
Partially correct |
89 ms |
11528 KB |
Output is partially correct |
12 |
Partially correct |
83 ms |
10408 KB |
Output is partially correct |
13 |
Partially correct |
92 ms |
10704 KB |
Output is partially correct |
14 |
Partially correct |
87 ms |
10584 KB |
Output is partially correct |
15 |
Partially correct |
88 ms |
10572 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
696 KB |
Output is partially correct |
17 |
Correct |
46 ms |
6348 KB |
Output is correct |
18 |
Partially correct |
86 ms |
10400 KB |
Output is partially correct |
19 |
Partially correct |
87 ms |
10396 KB |
Output is partially correct |
20 |
Partially correct |
108 ms |
11568 KB |
Output is partially correct |
21 |
Partially correct |
90 ms |
11564 KB |
Output is partially correct |
22 |
Partially correct |
100 ms |
11468 KB |
Output is partially correct |