#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, vector<int> A) {
A.push_back(0);
int N = A.size();
vector<int> C(M + 1, 0);
vector<int> X, Y;
vector<int> pos[M + 1];
for (int i = 0; i < N; i++){
pos[A[i]].push_back(i);
}
int S = 0;
C[0] = A[0];
for (int id = 0; id <= M; id++){
if (pos[id].empty()) continue;
if (pos[id].size() == 1){
int i = pos[id][0];
C[A[i]] = A[(i + 1) % N];
continue;
}
if (pos[id].size() == 2){
int i = pos[id][0], j = pos[id][1];
S++;
X.push_back(0);
Y.push_back(0);
C[A[i]] = -S;
X[S - 1] = A[(i + 1) % N];
Y[S - 1] = A[(j + 1) % N];
continue;
}
if (pos[id].size() == 3){
int i = pos[id][0], j = pos[id][1], k = pos[id][2];
S += 3;
X.push_back(0);
X.push_back(0);
X.push_back(0);
Y.push_back(0);
Y.push_back(0);
Y.push_back(0);
C[A[i]] = -(S - 2);
X[S - 3] = -(S - 1);
Y[S - 3] = -S;
X[S - 2] = -(S - 2);
Y[S - 2] = A[(j + 1) % N];
X[S - 1] = A[(i + 1) % N];
Y[S - 1] = A[(k + 1) % N];
continue;
}
if (pos[id].size() == 4){
int i = pos[id][0], j = pos[id][1], k = pos[id][2], l = pos[id][3];
S += 3;
X.push_back(0);
X.push_back(0);
X.push_back(0);
Y.push_back(0);
Y.push_back(0);
Y.push_back(0);
C[A[i]] = -(S - 2);
X[S - 3] = -(S - 1);
Y[S - 3] = -S;
X[S - 2] = A[(i + 1) % N];
Y[S - 2] = A[(k + 1) % N];
X[S - 1] = A[(j + 1) % N];
Y[S - 1] = A[(l + 1) % N];
continue;
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
26 ms |
6320 KB |
Output is correct |
3 |
Correct |
29 ms |
5168 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
11 ms |
3788 KB |
Output is correct |
6 |
Correct |
31 ms |
7852 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
26 ms |
6320 KB |
Output is correct |
3 |
Correct |
29 ms |
5168 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
11 ms |
3788 KB |
Output is correct |
6 |
Correct |
31 ms |
7852 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
41 ms |
7956 KB |
Output is correct |
9 |
Correct |
46 ms |
9088 KB |
Output is correct |
10 |
Correct |
77 ms |
12368 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
26 ms |
6320 KB |
Output is correct |
3 |
Correct |
29 ms |
5168 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
11 ms |
3788 KB |
Output is correct |
6 |
Correct |
31 ms |
7852 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
41 ms |
7956 KB |
Output is correct |
9 |
Correct |
46 ms |
9088 KB |
Output is correct |
10 |
Correct |
77 ms |
12368 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
0 ms |
204 KB |
Output is correct |
13 |
Correct |
0 ms |
204 KB |
Output is correct |
14 |
Correct |
86 ms |
11764 KB |
Output is correct |
15 |
Correct |
46 ms |
7752 KB |
Output is correct |
16 |
Correct |
70 ms |
10452 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
0 ms |
208 KB |
Output is correct |
20 |
Correct |
76 ms |
12552 KB |
Output is correct |
21 |
Correct |
1 ms |
208 KB |
Output is correct |
22 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |