#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void create_circuit(int M, vector<int> A) {
int N = A.size(), cnt = -1;
vector<int> C(M + 1, -1e9), X, Y, S;
C[0] = A[0];
A.pb(0);
for (int i = 0; i < N; ++i) {
int cur = C[A[i]];
if(cur == -1e9) C[A[i]] = A[i + 1];
else{
int pre = A[i];
while(cur < 0){
pre = cur;
if(S[-cur - 1]) cur = Y[-cur - 1];
else cur = X[-cur - 1];
S[-pre - 1] ^= 1;
}
if(cur == A[i + 1]) continue;
if(pre == A[i]){
C[A[i]] = cnt--;
X.pb(cur);
Y.pb(A[i + 1]);
S.pb(0);
}else{
if(S[-pre - 1]){
X[-pre - 1] = cnt--;
X.pb(cur);
Y.pb(A[i + 1]);
}else{
Y[-pre - 1] = cnt--;
X.pb(cur);
Y.pb(A[i + 1]);
}
S.pb(1);
}
}
}
for(auto &x:C) x = (x == -1e9 ? 1 : x), cerr << x << ' ';
cerr << '\n';
for(auto x:X) cerr << x << ' ';
cerr << '\n';
for(auto x:Y) cerr << x << ' ';
cerr << '\n';
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
246 ms |
2376 KB |
Output is correct |
3 |
Correct |
173 ms |
1956 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
236 ms |
1644 KB |
Output is correct |
6 |
Correct |
252 ms |
2808 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
246 ms |
2376 KB |
Output is correct |
3 |
Correct |
173 ms |
1956 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
236 ms |
1644 KB |
Output is correct |
6 |
Correct |
252 ms |
2808 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
498 ms |
5816 KB |
Output is correct |
9 |
Correct |
482 ms |
5232 KB |
Output is correct |
10 |
Correct |
735 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
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 |
246 ms |
2376 KB |
Output is correct |
3 |
Correct |
173 ms |
1956 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
236 ms |
1644 KB |
Output is correct |
6 |
Correct |
252 ms |
2808 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
498 ms |
5816 KB |
Output is correct |
9 |
Correct |
482 ms |
5232 KB |
Output is correct |
10 |
Correct |
735 ms |
8540 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Incorrect |
880 ms |
9208 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 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 |
- |