#include <bits/stdc++.h>
using namespace std;
#include "doll.h"
vector<int> s, x(3e5), y(3e5), z(3e5);
int v, b = 1, n;
int dfs(int l, int r) {
if(l >= n) return -1;
if(r - l > 1) {
int m = (l + r) / 2, u = v++;
y[u] = dfs(l, m);
x[u] = dfs(m, r);
return -u-1;
}
return 1;
}
void create_circuit(int M, vector<int> A) {
s.assign(M+1, -1);
A.push_back(0);
n = size(A);
while(b<n) b += b;
dfs(0, b);
for(int &i : A) {
int u = 0;
while(u >= 0) {
z[u] ^= 1;
int &w = z[u] ? x[u] : y[u];
if(w >= 0) w = i, u = -1;
else u = -1-w;
}
}
x.resize(v);
y.resize(v);
answer(s, x, y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3788 KB |
Output is correct |
2 |
Correct |
43 ms |
6996 KB |
Output is correct |
3 |
Correct |
40 ms |
6844 KB |
Output is correct |
4 |
Correct |
2 ms |
3788 KB |
Output is correct |
5 |
Correct |
10 ms |
4940 KB |
Output is correct |
6 |
Correct |
62 ms |
8412 KB |
Output is correct |
7 |
Correct |
2 ms |
3788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3788 KB |
Output is correct |
2 |
Correct |
43 ms |
6996 KB |
Output is correct |
3 |
Correct |
40 ms |
6844 KB |
Output is correct |
4 |
Correct |
2 ms |
3788 KB |
Output is correct |
5 |
Correct |
10 ms |
4940 KB |
Output is correct |
6 |
Correct |
62 ms |
8412 KB |
Output is correct |
7 |
Correct |
2 ms |
3788 KB |
Output is correct |
8 |
Correct |
82 ms |
8932 KB |
Output is correct |
9 |
Correct |
85 ms |
9448 KB |
Output is correct |
10 |
Correct |
121 ms |
11868 KB |
Output is correct |
11 |
Correct |
1 ms |
3788 KB |
Output is correct |
12 |
Correct |
1 ms |
3788 KB |
Output is correct |
13 |
Correct |
1 ms |
3788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3788 KB |
Output is correct |
2 |
Correct |
43 ms |
6996 KB |
Output is correct |
3 |
Correct |
40 ms |
6844 KB |
Output is correct |
4 |
Correct |
2 ms |
3788 KB |
Output is correct |
5 |
Correct |
10 ms |
4940 KB |
Output is correct |
6 |
Correct |
62 ms |
8412 KB |
Output is correct |
7 |
Correct |
2 ms |
3788 KB |
Output is correct |
8 |
Correct |
82 ms |
8932 KB |
Output is correct |
9 |
Correct |
85 ms |
9448 KB |
Output is correct |
10 |
Correct |
121 ms |
11868 KB |
Output is correct |
11 |
Correct |
1 ms |
3788 KB |
Output is correct |
12 |
Correct |
1 ms |
3788 KB |
Output is correct |
13 |
Correct |
1 ms |
3788 KB |
Output is correct |
14 |
Correct |
119 ms |
11320 KB |
Output is correct |
15 |
Correct |
79 ms |
8552 KB |
Output is correct |
16 |
Correct |
117 ms |
11168 KB |
Output is correct |
17 |
Correct |
2 ms |
3788 KB |
Output is correct |
18 |
Correct |
2 ms |
3788 KB |
Output is correct |
19 |
Correct |
1 ms |
3788 KB |
Output is correct |
20 |
Correct |
123 ms |
11480 KB |
Output is correct |
21 |
Correct |
2 ms |
3788 KB |
Output is correct |
22 |
Correct |
2 ms |
3788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
3788 KB |
Output is correct |
2 |
Correct |
2 ms |
3788 KB |
Output is correct |
3 |
Correct |
2 ms |
3788 KB |
Output is correct |
4 |
Correct |
2 ms |
3788 KB |
Output is correct |
5 |
Correct |
2 ms |
3788 KB |
Output is correct |
6 |
Correct |
1 ms |
3788 KB |
Output is correct |
7 |
Correct |
2 ms |
3788 KB |
Output is correct |
8 |
Correct |
2 ms |
3788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3788 KB |
Output is correct |
2 |
Correct |
75 ms |
7520 KB |
Output is correct |
3 |
Correct |
73 ms |
7520 KB |
Output is correct |
4 |
Correct |
116 ms |
9688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
3788 KB |
Output is correct |
2 |
Correct |
75 ms |
7520 KB |
Output is correct |
3 |
Correct |
73 ms |
7520 KB |
Output is correct |
4 |
Correct |
116 ms |
9688 KB |
Output is correct |
5 |
Correct |
116 ms |
10852 KB |
Output is correct |
6 |
Correct |
122 ms |
10572 KB |
Output is correct |
7 |
Correct |
119 ms |
10704 KB |
Output is correct |
8 |
Correct |
112 ms |
10400 KB |
Output is correct |
9 |
Correct |
74 ms |
7536 KB |
Output is correct |
10 |
Correct |
118 ms |
10276 KB |
Output is correct |
11 |
Correct |
115 ms |
9944 KB |
Output is correct |
12 |
Correct |
75 ms |
7792 KB |
Output is correct |
13 |
Correct |
78 ms |
8164 KB |
Output is correct |
14 |
Correct |
79 ms |
8240 KB |
Output is correct |
15 |
Correct |
78 ms |
8380 KB |
Output is correct |
16 |
Correct |
3 ms |
3916 KB |
Output is correct |
17 |
Correct |
68 ms |
7836 KB |
Output is correct |
18 |
Correct |
76 ms |
7688 KB |
Output is correct |
19 |
Correct |
75 ms |
7776 KB |
Output is correct |
20 |
Correct |
112 ms |
10200 KB |
Output is correct |
21 |
Correct |
120 ms |
9944 KB |
Output is correct |
22 |
Correct |
110 ms |
9984 KB |
Output is correct |