#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MAX_M = 1e5 + 5;
int N, M, S;
vector <int> nxt[MAX_M];
vector<int> C, X, Y;
void create_circuit(int m, vector <int> A) {
N = A.size(), M = m;
C.resize(M + 1);
A.push_back(0);
for(int i = 0; i < N; i++) {
nxt[A[i]].push_back(A[i + 1]);
}
C[0] = A[0];
for(int a = 1; a <= M; a++) {
if(nxt[a].empty()) {
continue;
}
else if(nxt[a].size() == 1) {
C[a] = nxt[a][0];
}
else {
S++;
C[a] = -S;
if(nxt[a].size() == 2) {
X.push_back(nxt[a][0]);
Y.push_back(nxt[a][1]);
}
else if(nxt[a].size() == 3) {
X.push_back(-(++S));
Y.push_back(-(++S));
X.push_back(nxt[a][0]);
Y.push_back(-(S - 2));
X.push_back(nxt[a][1]);
Y.push_back(nxt[a][2]);
}
else if(nxt[a].size() == 4) {
X.push_back(-(++S));
Y.push_back(-(++S));
X.push_back(nxt[a][0]);
Y.push_back(nxt[a][2]);
X.push_back(nxt[a][1]);
Y.push_back(nxt[a][3]);
}
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
24 ms |
6352 KB |
Output is correct |
3 |
Correct |
22 ms |
6104 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
33 ms |
7952 KB |
Output is correct |
7 |
Correct |
1 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
24 ms |
6352 KB |
Output is correct |
3 |
Correct |
22 ms |
6104 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
33 ms |
7952 KB |
Output is correct |
7 |
Correct |
1 ms |
2644 KB |
Output is correct |
8 |
Correct |
50 ms |
8696 KB |
Output is correct |
9 |
Correct |
44 ms |
9176 KB |
Output is correct |
10 |
Correct |
64 ms |
12340 KB |
Output is correct |
11 |
Correct |
2 ms |
2644 KB |
Output is correct |
12 |
Correct |
2 ms |
2644 KB |
Output is correct |
13 |
Correct |
1 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2644 KB |
Output is correct |
2 |
Correct |
24 ms |
6352 KB |
Output is correct |
3 |
Correct |
22 ms |
6104 KB |
Output is correct |
4 |
Correct |
2 ms |
2644 KB |
Output is correct |
5 |
Correct |
10 ms |
3796 KB |
Output is correct |
6 |
Correct |
33 ms |
7952 KB |
Output is correct |
7 |
Correct |
1 ms |
2644 KB |
Output is correct |
8 |
Correct |
50 ms |
8696 KB |
Output is correct |
9 |
Correct |
44 ms |
9176 KB |
Output is correct |
10 |
Correct |
64 ms |
12340 KB |
Output is correct |
11 |
Correct |
2 ms |
2644 KB |
Output is correct |
12 |
Correct |
2 ms |
2644 KB |
Output is correct |
13 |
Correct |
1 ms |
2644 KB |
Output is correct |
14 |
Correct |
89 ms |
14052 KB |
Output is correct |
15 |
Correct |
52 ms |
9400 KB |
Output is correct |
16 |
Correct |
65 ms |
12800 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2644 KB |
Output is correct |
20 |
Correct |
81 ms |
14260 KB |
Output is correct |
21 |
Correct |
2 ms |
2644 KB |
Output is correct |
22 |
Correct |
2 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2644 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2644 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2644 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |