#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
int N = A.size();
vector<int> f(M + 1);
for (int i = 0; i < N; i++) {
f[A[i]]++;
}
vector<int> C(M + 1);
int K = 0;
for (int i = 1; i <= M; i++) {
if (f[i] == 2) {
C[i] = ~K;
K++;
}
}
vector<int> X(K), Y(K);
C[0] = A[0];
for (int i = 0; i < N; i++) {
if (f[A[i]] == 1) {
C[A[i]] = i + 1 < N ? A[i + 1] : 0;
} else if (f[A[i]] == 2) {
X[~C[A[i]]] = A[i + 1];
f[A[i]] = -1;
} else {
Y[~C[A[i]]] = i + 1 < N ? A[i + 1] : 0;
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
13 ms |
2388 KB |
Output is correct |
3 |
Correct |
10 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
1920 KB |
Output is correct |
6 |
Correct |
15 ms |
2644 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
13 ms |
2388 KB |
Output is correct |
3 |
Correct |
10 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
1920 KB |
Output is correct |
6 |
Correct |
15 ms |
2644 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
25 ms |
3924 KB |
Output is correct |
9 |
Correct |
26 ms |
4828 KB |
Output is correct |
10 |
Correct |
39 ms |
7220 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
13 ms |
2388 KB |
Output is correct |
3 |
Correct |
10 ms |
1876 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
11 ms |
1920 KB |
Output is correct |
6 |
Correct |
15 ms |
2644 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
25 ms |
3924 KB |
Output is correct |
9 |
Correct |
26 ms |
4828 KB |
Output is correct |
10 |
Correct |
39 ms |
7220 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
300 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Runtime error |
18 ms |
6064 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |