//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
#define ve vector
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9 + 10;
void create_circuit(int m, ve<int> A) {
int n, l, s, k, z;
ve<int> C, X, Y;
ve<bool> B;
n = A.size();
l = ceil(log2(n + 1));
s = 1 << l;
C = ve<int>(m + 1);
X = ve<int>(s - 1);
Y = ve<int>(s - 1);
B = ve<bool>(s);
for (int i = 0; i <= m; i++) C[i] = -1;
for (int i = 1; i < s / 2; i++) {
X[i - 1] = -(2 * i);
Y[i - 1] = -(2 * i + 1);
}
for (int i = 0; i < s; i++) {
k = 1;
for (int j = 0; j < l - 1; j++) {
if (B[k]) {
B[k] = !B[k];
k = -Y[k - 1];
}
else {
B[k] = !B[k];
k = -X[k - 1];
}
}
if (i < n) z = A[i];
else if (i == s - 1) z = 0;
else z = -1;
if (B[k]) {
B[k] = !B[k];
Y[k - 1] = z;
}
else {
B[k] = !B[k];
X[k - 1] = z;
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
120 ms |
7464 KB |
Output is partially correct |
3 |
Partially correct |
118 ms |
7496 KB |
Output is partially correct |
4 |
Partially correct |
145 ms |
7988 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
204 KB |
Output is partially correct |
2 |
Partially correct |
120 ms |
7464 KB |
Output is partially correct |
3 |
Partially correct |
118 ms |
7496 KB |
Output is partially correct |
4 |
Partially correct |
145 ms |
7988 KB |
Output is partially correct |
5 |
Partially correct |
136 ms |
8456 KB |
Output is partially correct |
6 |
Partially correct |
144 ms |
8232 KB |
Output is partially correct |
7 |
Partially correct |
134 ms |
8272 KB |
Output is partially correct |
8 |
Partially correct |
128 ms |
8120 KB |
Output is partially correct |
9 |
Partially correct |
114 ms |
7492 KB |
Output is partially correct |
10 |
Partially correct |
128 ms |
8116 KB |
Output is partially correct |
11 |
Partially correct |
131 ms |
7992 KB |
Output is partially correct |
12 |
Partially correct |
120 ms |
7464 KB |
Output is partially correct |
13 |
Partially correct |
120 ms |
7592 KB |
Output is partially correct |
14 |
Partially correct |
117 ms |
7704 KB |
Output is partially correct |
15 |
Partially correct |
125 ms |
7748 KB |
Output is partially correct |
16 |
Partially correct |
6 ms |
588 KB |
Output is partially correct |
17 |
Correct |
66 ms |
4352 KB |
Output is correct |
18 |
Partially correct |
117 ms |
7500 KB |
Output is partially correct |
19 |
Partially correct |
115 ms |
7504 KB |
Output is partially correct |
20 |
Partially correct |
140 ms |
7988 KB |
Output is partially correct |
21 |
Partially correct |
125 ms |
8040 KB |
Output is partially correct |
22 |
Partially correct |
136 ms |
8040 KB |
Output is partially correct |