#include "doll.h"
#include<algorithm>
using namespace std;
int magic(vector<int> &X,vector<int> &Y,vector<int> &G,int L,int R){
if(L == R){
return G[L];
}
int mid = (L+R)>>1;
X.push_back(magic(X,Y,G,L,mid));
Y.push_back(magic(X,Y,G,mid+1,R));
return -X.size();
}
void create_circuit(int M, std::vector<int> A) {
int N = A.size();
vector<int> C(M + 1);
vector<int> X, Y;
vector<int> G[M+1];
vector<int> next(M+1), cnt(M+1,0);
for(int i=0;i<N-1;i++){
cnt[A[i]]++;
G[A[i]].push_back(A[i+1]);
}
C[0] = A[0];
for(int i=0;i<N-1;i++){
if(cnt[A[i]] == 1){
C[A[i]] = A[i+1];
} else {
C[A[i]] = magic(X, Y, G[A[i]], 0, G[A[i]].size()-1);
}
}
C[A[N-1]] = 0;
answer(C, X, Y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
33 ms |
7152 KB |
Output is correct |
3 |
Correct |
36 ms |
5672 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
20 ms |
4556 KB |
Output is correct |
6 |
Correct |
47 ms |
8496 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
33 ms |
7152 KB |
Output is correct |
3 |
Correct |
36 ms |
5672 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
20 ms |
4556 KB |
Output is correct |
6 |
Correct |
47 ms |
8496 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Incorrect |
91 ms |
9152 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
33 ms |
7152 KB |
Output is correct |
3 |
Correct |
36 ms |
5672 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
20 ms |
4556 KB |
Output is correct |
6 |
Correct |
47 ms |
8496 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Incorrect |
91 ms |
9152 KB |
wrong motion |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |