#include "doll.h"
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
void create_circuit(int M, std::vector<int> A) {
vector<int> C(M+1);
vector<int> X, Y;
int N = A.size();
C[0] = A[0];
vector<int> all[M+1];
for(int i=0; i<N; i++) all[A[i]].push_back(i);
for(int i=1; i<=M; i++) {
if(all[i].size() == 1) {
C[i] = (all[i][0] == N-1 ? 0 : A[all[i][0] + 1]);
}
else if(all[i].size() == 2) {
C[i] = -X.size() - 1;
X.push_back((all[i][0] == N-1 ? 0 : A[all[i][0] + 1]));
Y.push_back((all[i][1] == N-1 ? 0 : A[all[i][1] + 1]));
}
}
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
23 ms |
6348 KB |
Output is correct |
3 |
Correct |
18 ms |
5068 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
9 ms |
3788 KB |
Output is correct |
6 |
Correct |
30 ms |
7720 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
23 ms |
6348 KB |
Output is correct |
3 |
Correct |
18 ms |
5068 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
9 ms |
3788 KB |
Output is correct |
6 |
Correct |
30 ms |
7720 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
40 ms |
7252 KB |
Output is correct |
9 |
Correct |
44 ms |
9540 KB |
Output is correct |
10 |
Correct |
63 ms |
12440 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
23 ms |
6348 KB |
Output is correct |
3 |
Correct |
18 ms |
5068 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
9 ms |
3788 KB |
Output is correct |
6 |
Correct |
30 ms |
7720 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
40 ms |
7252 KB |
Output is correct |
9 |
Correct |
44 ms |
9540 KB |
Output is correct |
10 |
Correct |
63 ms |
12440 KB |
Output is correct |
11 |
Correct |
0 ms |
204 KB |
Output is correct |
12 |
Correct |
1 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
284 KB |
Output is correct |
14 |
Incorrect |
39 ms |
7748 KB |
wrong motion |
15 |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |