#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(a) (int)a.size()
void create_circuit(int M, vector<int> A) {
A.insert(A.begin(),0); A.push_back(0);
int n = A.size();
vector<int> C(M+1,0), X, Y;
int cnt[M+1]{0}, ind = -1;
vector<int> v; v.clear();
for(int i = 0; i < n; i++){
cnt[A[i]]++;
if(A[i] and cnt[A[i]]==2) v.pb(ind--);
v.pb(A[i]);
}
v.pb(0);
for(int i = 0; i < sz(v)-2; i++){
if(v[i]<0) X.pb(v[i+1]),Y.pb(v[i+2]),i++;
else if(C[v[i]]==0) C[v[i]]=v[i+1];
}
answer(C,X,Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
16 ms |
2744 KB |
Output is correct |
3 |
Correct |
13 ms |
2104 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1748 KB |
Output is correct |
6 |
Correct |
19 ms |
3020 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
16 ms |
2744 KB |
Output is correct |
3 |
Correct |
13 ms |
2104 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1748 KB |
Output is correct |
6 |
Correct |
19 ms |
3020 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Incorrect |
33 ms |
4744 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
16 ms |
2744 KB |
Output is correct |
3 |
Correct |
13 ms |
2104 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1748 KB |
Output is correct |
6 |
Correct |
19 ms |
3020 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Incorrect |
33 ms |
4744 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |