#include <bits/stdc++.h>
using namespace std;
#include "doll.h"
const int N = 400000;
int c[N], x[N], y[N], ext, s;
int build(int k) {
if (k <= ext) {
ext -= k;
return 1;
} else if (k == 1) {
return 0;
}
int u = ++s;
x[u - 1] = -build(k / 2);
y[u - 1] = -build(k / 2);
return u;
}
void create_circuit(int m, vector<int> a) {
int n = a.size();
int k = 1;
while (k < n) {
k *= 2;
}
ext = k - n;
int u = build(k);
fill(c + 1, c + m + 1, -u);
c[0] = a[0];
a.push_back(0);
a.erase(a.begin());
for (int i = 0; i < n; ++i) {
int v = u;
while (x[v - 1] != 0) {
swap(x[v - 1], y[v - 1]);
v = -y[v - 1];
}
swap(x[v - 1], y[v - 1]);
y[v - 1] = a[i];
}
answer(vector<int>(c, c + m + 1), vector<int>(x, x + s), vector<int>(y, y + s));
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
45 ms |
3940 KB |
Output is correct |
3 |
Correct |
52 ms |
3876 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
14 ms |
1484 KB |
Output is correct |
6 |
Correct |
60 ms |
5732 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
45 ms |
3940 KB |
Output is correct |
3 |
Correct |
52 ms |
3876 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
14 ms |
1484 KB |
Output is correct |
6 |
Correct |
60 ms |
5732 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
72 ms |
6460 KB |
Output is correct |
9 |
Correct |
77 ms |
7004 KB |
Output is correct |
10 |
Correct |
114 ms |
9932 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
45 ms |
3940 KB |
Output is correct |
3 |
Correct |
52 ms |
3876 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
14 ms |
1484 KB |
Output is correct |
6 |
Correct |
60 ms |
5732 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
72 ms |
6460 KB |
Output is correct |
9 |
Correct |
77 ms |
7004 KB |
Output is correct |
10 |
Correct |
114 ms |
9932 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
121 ms |
9324 KB |
Output is correct |
15 |
Correct |
80 ms |
6080 KB |
Output is correct |
16 |
Correct |
108 ms |
9124 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
1 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
108 ms |
9584 KB |
Output is correct |
21 |
Correct |
1 ms |
204 KB |
Output is correct |
22 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
70 ms |
5060 KB |
Output is correct |
3 |
Correct |
73 ms |
5028 KB |
Output is correct |
4 |
Correct |
99 ms |
7584 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
70 ms |
5060 KB |
Output is correct |
3 |
Correct |
73 ms |
5028 KB |
Output is correct |
4 |
Correct |
99 ms |
7584 KB |
Output is correct |
5 |
Correct |
106 ms |
8976 KB |
Output is correct |
6 |
Correct |
104 ms |
8636 KB |
Output is correct |
7 |
Correct |
105 ms |
8732 KB |
Output is correct |
8 |
Correct |
123 ms |
8344 KB |
Output is correct |
9 |
Correct |
64 ms |
5048 KB |
Output is correct |
10 |
Correct |
106 ms |
8352 KB |
Output is correct |
11 |
Correct |
105 ms |
8000 KB |
Output is correct |
12 |
Correct |
65 ms |
5236 KB |
Output is correct |
13 |
Correct |
65 ms |
5728 KB |
Output is correct |
14 |
Correct |
68 ms |
5808 KB |
Output is correct |
15 |
Correct |
71 ms |
5916 KB |
Output is correct |
16 |
Correct |
3 ms |
460 KB |
Output is correct |
17 |
Correct |
66 ms |
5356 KB |
Output is correct |
18 |
Correct |
61 ms |
5280 KB |
Output is correct |
19 |
Correct |
72 ms |
5272 KB |
Output is correct |
20 |
Correct |
100 ms |
8212 KB |
Output is correct |
21 |
Correct |
112 ms |
7952 KB |
Output is correct |
22 |
Correct |
102 ms |
8072 KB |
Output is correct |