#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
int N = A.size();
vector<int> C(M + 1), X, Y, T(M + 1), E(M + 1);
A.insert(A.begin(), 0);
for (int i : A) {
++T[i];
}
A.push_back(0);
for (int i = 0; i <= N; ++i) {
--T[A[i]];
if (T[A[i]] == 0) {
if (E[A[i]] == 0) {
C[A[i]] = A[i + 1];
}
else {
Y[E[A[i]] - 1] = A[i + 1];
}
}
else {
if (E[A[i]] == 0) {
X.push_back(A[i + 1]);
Y.push_back(0);
E[A[i]] = X.size();
C[A[i]] = -E[A[i]];
}
else {
X.push_back(A[i + 1]);
Y.push_back(0);
Y[E[A[i]] - 1] = X.size();
E[A[i]] = X.size();
}
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
21 ms |
3144 KB |
Output is correct |
3 |
Correct |
17 ms |
2568 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
11 ms |
2252 KB |
Output is correct |
6 |
Correct |
31 ms |
3680 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
21 ms |
3144 KB |
Output is correct |
3 |
Correct |
17 ms |
2568 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
11 ms |
2252 KB |
Output is correct |
6 |
Correct |
31 ms |
3680 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
44 ms |
5064 KB |
Output is correct |
9 |
Correct |
42 ms |
5148 KB |
Output is correct |
10 |
Correct |
65 ms |
7996 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
21 ms |
3144 KB |
Output is correct |
3 |
Correct |
17 ms |
2568 KB |
Output is correct |
4 |
Correct |
1 ms |
288 KB |
Output is correct |
5 |
Correct |
11 ms |
2252 KB |
Output is correct |
6 |
Correct |
31 ms |
3680 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
44 ms |
5064 KB |
Output is correct |
9 |
Correct |
42 ms |
5148 KB |
Output is correct |
10 |
Correct |
65 ms |
7996 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 |
Incorrect |
67 ms |
7696 KB |
wrong serial number |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |