#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int S = 0;
vector<int> X, Y;
int create_switch(int L, int R) {
X.push_back(L);
Y.push_back(R);
S++;
return -S;
}
int build(vector<int> v) {
if ((int)v.size() == 1) {
return v[0];
}
if (v[0] == -1 && v.back() == -1) {
return -1;
}
int m = (int)v.size();
int L, R;
if (m & 1) {
if (v.back()) {
v.push_back(-1);
} else {
v.pop_back();
v.push_back(-1);
v.push_back(0);
}
m++;
}
vector<int> lv, rv;
for (int i = 0; i < m; i++) {
if (i & 1) rv.push_back(v[i]);
else lv.push_back(v[i]);
}
L = build(lv);
R = build(rv);
return create_switch(L, R);
}
void create_circuit(int M, vector<int> A) {
A.push_back(0);
create_switch(-1, -1);
int root = build(A);
Y[0] = root;
vector<int> C(M + 1, root);
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
2 |
Partially correct |
67 ms |
12632 KB |
Output is partially correct |
3 |
Partially correct |
71 ms |
13116 KB |
Output is partially correct |
4 |
Partially correct |
75 ms |
13528 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
0 ms |
344 KB |
Output is partially correct |
2 |
Partially correct |
67 ms |
12632 KB |
Output is partially correct |
3 |
Partially correct |
71 ms |
13116 KB |
Output is partially correct |
4 |
Partially correct |
75 ms |
13528 KB |
Output is partially correct |
5 |
Partially correct |
79 ms |
14828 KB |
Output is partially correct |
6 |
Partially correct |
81 ms |
13848 KB |
Output is partially correct |
7 |
Partially correct |
79 ms |
14568 KB |
Output is partially correct |
8 |
Partially correct |
84 ms |
14408 KB |
Output is partially correct |
9 |
Partially correct |
69 ms |
12592 KB |
Output is partially correct |
10 |
Partially correct |
75 ms |
14108 KB |
Output is partially correct |
11 |
Partially correct |
80 ms |
13672 KB |
Output is partially correct |
12 |
Partially correct |
79 ms |
13516 KB |
Output is partially correct |
13 |
Partially correct |
71 ms |
13252 KB |
Output is partially correct |
14 |
Partially correct |
73 ms |
13768 KB |
Output is partially correct |
15 |
Partially correct |
75 ms |
14024 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
604 KB |
Output is partially correct |
17 |
Correct |
38 ms |
7340 KB |
Output is correct |
18 |
Partially correct |
79 ms |
12740 KB |
Output is partially correct |
19 |
Partially correct |
69 ms |
13512 KB |
Output is partially correct |
20 |
Partially correct |
76 ms |
13800 KB |
Output is partially correct |
21 |
Partially correct |
76 ms |
13848 KB |
Output is partially correct |
22 |
Partially correct |
73 ms |
14052 KB |
Output is partially correct |