#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define vi vector<int>
void create_circuit(int nbT, std::vector<int> b) {
vi tOut(nbT+1, -1);
int p2 = 1;
while (p2*2 <= sz(b)) p2 *= 2;
vi xSw(2*p2-1);
vi ySw(2*p2-1);
for (int i = 0; i < p2-1; i++) {
assert(0 <= i && i < 2*p2-1);
xSw[i] = -2*(i+1);
ySw[i] = -2*(i+1)-1;
}
for (int i = p2-1; i < 2*p2-1; i++) {
assert(0 <= i && i < 2*p2-1);
xSw[i] = ySw[i] = -1;
}
ySw[2*p2-2] = 0;
vi ptr(2*p2-1);
for (int i = 0; i < p2/2; i++) ptr[i] = 0;
for (int i : b) {
int x = 0;
while (x < p2-1) {
assert(0 <= i && i < 2*p2-1);
ptr[x] ^= 1;
if (ptr[x] == 1) {
x = -xSw[x]-1;
}
else {
x = -ySw[x]-1;
}
}
assert(0 <= x && x < 2*p2-1);
if (ptr[x] == 0) {
assert(xSw[x] == -1);
xSw[x] = i;
}
else {
assert(ySw[x] == -1);
ySw[x] = i;
}
ptr[x] ^= 1;
}
if (p2 >= 2) for (int i = p2-1; i < 2*p2-1; i++) {
assert(xSw[i] != -1);
}
answer(tOut, xSw, ySw);
}
# |
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 |
212 KB |
Output is partially correct |
2 |
Partially correct |
79 ms |
8532 KB |
Output is partially correct |
3 |
Partially correct |
78 ms |
8524 KB |
Output is partially correct |
4 |
Partially correct |
103 ms |
9040 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
212 KB |
Output is partially correct |
2 |
Partially correct |
79 ms |
8532 KB |
Output is partially correct |
3 |
Partially correct |
78 ms |
8524 KB |
Output is partially correct |
4 |
Partially correct |
103 ms |
9040 KB |
Output is partially correct |
5 |
Partially correct |
99 ms |
9464 KB |
Output is partially correct |
6 |
Partially correct |
97 ms |
9272 KB |
Output is partially correct |
7 |
Partially correct |
109 ms |
9284 KB |
Output is partially correct |
8 |
Partially correct |
98 ms |
9164 KB |
Output is partially correct |
9 |
Partially correct |
76 ms |
8520 KB |
Output is partially correct |
10 |
Partially correct |
99 ms |
9084 KB |
Output is partially correct |
11 |
Partially correct |
98 ms |
8964 KB |
Output is partially correct |
12 |
Partially correct |
79 ms |
8496 KB |
Output is partially correct |
13 |
Partially correct |
84 ms |
8692 KB |
Output is partially correct |
14 |
Partially correct |
79 ms |
8724 KB |
Output is partially correct |
15 |
Partially correct |
81 ms |
8756 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
596 KB |
Output is partially correct |
17 |
Correct |
56 ms |
4896 KB |
Output is correct |
18 |
Partially correct |
78 ms |
8520 KB |
Output is partially correct |
19 |
Partially correct |
78 ms |
8512 KB |
Output is partially correct |
20 |
Partially correct |
99 ms |
9060 KB |
Output is partially correct |
21 |
Partially correct |
96 ms |
9048 KB |
Output is partially correct |
22 |
Partially correct |
95 ms |
9036 KB |
Output is partially correct |