#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];
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);
}
}
}
if(C[A[M - 1]] == -1e9) C[A[M - 1]] = 0;
else{
int cur = C[A[M - 1]], pre = A[M - 1];
while(cur < 0){
pre = cur;
if(S[-cur - 1]) cur = Y[-cur - 1];
else cur = X[-cur - 1];
S[-pre - 1] ^= 1;
}
if(pre == A[M - 1]){
X.pb(cur);
Y.pb(0);
S.pb(1);
}else{
if(S[-pre - 1]){
X[-pre - 1] = cnt--;
X.pb(cur);
Y.pb(0);
}else{
Y[-pre - 1] = cnt--;
X.pb(cur);
Y.pb(0);
}
}
}
for(auto &x:C) cerr << x << ' ', x = (x == -1e9 ? 1 : 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 |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
244 ms |
2712 KB |
Output is correct |
3 |
Correct |
170 ms |
1972 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Runtime error |
2 ms |
1108 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
244 ms |
2712 KB |
Output is correct |
3 |
Correct |
170 ms |
1972 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Runtime error |
2 ms |
1108 KB |
Execution killed with signal 11 |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
244 ms |
2712 KB |
Output is correct |
3 |
Correct |
170 ms |
1972 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Runtime error |
2 ms |
1108 KB |
Execution killed with signal 11 |
6 |
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 |
- |