#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
int N, cnter = 0;
vector<int> adj[100001];
vector<int> X(400002), Y(400002);
vector<int> C(200002);
void build(int a, int cur, int l, int r){
if(l == r){
X[abs(cur)] = cur;
Y[abs(cur)] = l;
return;
}
if(l == r - 1){
X[abs(cur)] = adj[a][l];
Y[abs(cur)] = adj[a][r];
return;
}
int mid = (l + r) >> 1;
X[abs(cur)] = --cnter;
build(a, cnter, l, mid);
Y[abs(cur)] = --cnter;
build(a, cnter, mid + 1, r);
}
void create_circuit(int M, vector<int> A) {
N = A.size();
for(int i = 0; i < N - 1; i++) adj[A[i]].push_back(A[i + 1]);
adj[A[N - 1]].push_back(0);
C[0] = A[0];
for(int i = 1; i <= M; i++){
if(adj[i].size() == 0) continue;
if(adj[i].size() == 1) C[i] = adj[i][0];
else{
C[i] = --cnter;
build(i, cnter, 0, adj[i].size() - 1);
}
}
vector<int> CA, XA, YA;
for(int i = 1; i <= abs(cnter); i++){
XA.push_back(X[i]); YA.push_back(Y[i]);
}
for(int i = 0; i <= M; i++) CA.push_back(C[i]);
answer(CA, XA, YA);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
6484 KB |
Output is correct |
2 |
Correct |
28 ms |
10428 KB |
Output is correct |
3 |
Correct |
29 ms |
10368 KB |
Output is correct |
4 |
Correct |
4 ms |
6484 KB |
Output is correct |
5 |
Correct |
14 ms |
7884 KB |
Output is correct |
6 |
Correct |
42 ms |
12372 KB |
Output is correct |
7 |
Correct |
3 ms |
6484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
6484 KB |
Output is correct |
2 |
Correct |
28 ms |
10428 KB |
Output is correct |
3 |
Correct |
29 ms |
10368 KB |
Output is correct |
4 |
Correct |
4 ms |
6484 KB |
Output is correct |
5 |
Correct |
14 ms |
7884 KB |
Output is correct |
6 |
Correct |
42 ms |
12372 KB |
Output is correct |
7 |
Correct |
3 ms |
6484 KB |
Output is correct |
8 |
Correct |
46 ms |
12828 KB |
Output is correct |
9 |
Correct |
47 ms |
13380 KB |
Output is correct |
10 |
Correct |
69 ms |
16320 KB |
Output is correct |
11 |
Correct |
3 ms |
6484 KB |
Output is correct |
12 |
Correct |
3 ms |
6484 KB |
Output is correct |
13 |
Correct |
3 ms |
6484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
6484 KB |
Output is correct |
2 |
Correct |
28 ms |
10428 KB |
Output is correct |
3 |
Correct |
29 ms |
10368 KB |
Output is correct |
4 |
Correct |
4 ms |
6484 KB |
Output is correct |
5 |
Correct |
14 ms |
7884 KB |
Output is correct |
6 |
Correct |
42 ms |
12372 KB |
Output is correct |
7 |
Correct |
3 ms |
6484 KB |
Output is correct |
8 |
Correct |
46 ms |
12828 KB |
Output is correct |
9 |
Correct |
47 ms |
13380 KB |
Output is correct |
10 |
Correct |
69 ms |
16320 KB |
Output is correct |
11 |
Correct |
3 ms |
6484 KB |
Output is correct |
12 |
Correct |
3 ms |
6484 KB |
Output is correct |
13 |
Correct |
3 ms |
6484 KB |
Output is correct |
14 |
Incorrect |
82 ms |
17376 KB |
wrong motion |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
6484 KB |
wrong motion |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
6564 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
6564 KB |
wrong serial number |
2 |
Halted |
0 ms |
0 KB |
- |