#include "doll.h"
using namespace std;
int reverse(int x, int k) {
int y = 0;
for (int i = 0;i < k; i++) {
y = (y * 2) + (x % 2);
x /= 2;
}
return y;
}
void create_circuit(int M, std::vector<int> A) {
int n = A.size();
int k = 0;
while ((1 << (k + 1)) < n + 1) {
k++;
}
vector<int> x((1 << (k + 1)) - 1), y((1 << (k + 1)) - 1);
for (int i = 0; i < (1 << k) - 1; i++) {
x[i] = -((2 * i + 1) + 1);
y[i] = -((2 * i + 2) + 1);
}
for (int i = 0; i < (1 << k); i++) {
int t = reverse(2 * i, k + 1);
if (t < n) {
t = A[t];
} else {
t = -1;
}
x[(1 << k) - 1 + i] = t;
t = reverse(2 * i + 1, k + 1);
if (t < n) {
t = A[t];
} else if (i == (1 << k) - 1) {
t = 0;
} else {
t = -1;
}
y[(1 << k) - 1 + i] = t;
}
vector<int> c(M + 1, -1);
// for (int i = 0; i < x.size(); i++) {
// cout << x[i] << " " << y[i] << "\n";
// }
answer(c, x, y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
288 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 |
49 ms |
8348 KB |
Output is partially correct |
3 |
Partially correct |
50 ms |
8348 KB |
Output is partially correct |
4 |
Partially correct |
53 ms |
9428 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 |
49 ms |
8348 KB |
Output is partially correct |
3 |
Partially correct |
50 ms |
8348 KB |
Output is partially correct |
4 |
Partially correct |
53 ms |
9428 KB |
Output is partially correct |
5 |
Partially correct |
60 ms |
9892 KB |
Output is partially correct |
6 |
Partially correct |
60 ms |
9628 KB |
Output is partially correct |
7 |
Partially correct |
59 ms |
9700 KB |
Output is partially correct |
8 |
Partially correct |
59 ms |
9600 KB |
Output is partially correct |
9 |
Partially correct |
51 ms |
8404 KB |
Output is partially correct |
10 |
Partially correct |
73 ms |
9468 KB |
Output is partially correct |
11 |
Partially correct |
67 ms |
9420 KB |
Output is partially correct |
12 |
Partially correct |
59 ms |
8400 KB |
Output is partially correct |
13 |
Partially correct |
54 ms |
8608 KB |
Output is partially correct |
14 |
Partially correct |
64 ms |
8608 KB |
Output is partially correct |
15 |
Partially correct |
52 ms |
8652 KB |
Output is partially correct |
16 |
Partially correct |
2 ms |
596 KB |
Output is partially correct |
17 |
Correct |
30 ms |
5336 KB |
Output is correct |
18 |
Partially correct |
49 ms |
8416 KB |
Output is partially correct |
19 |
Partially correct |
50 ms |
8392 KB |
Output is partially correct |
20 |
Partially correct |
57 ms |
9500 KB |
Output is partially correct |
21 |
Partially correct |
59 ms |
9376 KB |
Output is partially correct |
22 |
Partially correct |
54 ms |
9496 KB |
Output is partially correct |