#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) begin(a),end(a)
const int mxN = (int)2e5+10;
int n, m;
bool vis[mxN];
vi a, v[mxN];
void getAns(){
vi C(m+1); C[0] = a[0];
for(int i = 0; i < n-1; i++) v[a[i]].pb(i);
for(int i = 1; i <= m; i++) C[i] = i;
int S = 0; vi X, Y;
for(int i = 0; i < n-1; i++){
if(!vis[a[i]]){
if(sz(v[a[i]])==2){
S++; C[a[i]] = -S;
X.pb(a[i+1]), Y.pb(a[v[a[i]][1]+1]);
}
else C[a[i]] = a[i+1];
}
vis[a[i]] = 1;
}
answer(C, X, Y);
}
void create_circuit(int M, vi A) {
m = M; a = A; a.push_back(0);
n = sz(a); getAns();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
19 ms |
9040 KB |
Output is correct |
3 |
Correct |
18 ms |
8688 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
10 ms |
6228 KB |
Output is correct |
6 |
Correct |
25 ms |
10692 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
19 ms |
9040 KB |
Output is correct |
3 |
Correct |
18 ms |
8688 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
10 ms |
6228 KB |
Output is correct |
6 |
Correct |
25 ms |
10692 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
34 ms |
11652 KB |
Output is correct |
9 |
Correct |
36 ms |
13064 KB |
Output is correct |
10 |
Correct |
52 ms |
17068 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4948 KB |
Output is correct |
2 |
Correct |
19 ms |
9040 KB |
Output is correct |
3 |
Correct |
18 ms |
8688 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
10 ms |
6228 KB |
Output is correct |
6 |
Correct |
25 ms |
10692 KB |
Output is correct |
7 |
Correct |
3 ms |
4948 KB |
Output is correct |
8 |
Correct |
34 ms |
11652 KB |
Output is correct |
9 |
Correct |
36 ms |
13064 KB |
Output is correct |
10 |
Correct |
52 ms |
17068 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
14 |
Incorrect |
34 ms |
11652 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4948 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4948 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4948 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |