#include "doll.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int NN=2e5+5;
vector<int> g[NN];
vector<int> x,y;
#define pb push_back
int generate(vector<int> &v, int &s, vector<int> &x, vector<int> &y){
int sz=v.size();
int k=1,K=0;
while(k<sz) k*=2,K++;
vector<int> rev(k);
for(int i=0;i<k;i++)
rev[i]=rev[i/2]/2 | ((i&1) << (K-1));
const int id=--s;
for(int i=0;i<(k-1)/2;i++){
x.pb(--s);
y.pb(--s);
}
for(int i=0;i<k;i++){
vector<int>& u=i%2? y:x;
if(rev[i]<k-sz)
u.pb(id);
else
u.pb(v[rev[i]-(k-sz)]);
}
return id;
}
void create_circuit(int m, vector<int> a) {
int n=a.size();
vector<int> c(m+1);
c[0]=a[0];
for(int i=0;i<n-1;i++){
g[a[i]].push_back(a[i+1]);
c[a[i]]=a[i+1];
}
g[a[n-1]].pb(0);
int id=0;
for(int i=1;i<=m;i++){
int sz=g[i].size();
if(sz<=1) continue;
c[i]=generate(g[i],id,x,y);
}
answer(c,x,y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
20 ms |
8852 KB |
Output is correct |
3 |
Correct |
20 ms |
8460 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
9 ms |
6100 KB |
Output is correct |
6 |
Correct |
26 ms |
10140 KB |
Output is correct |
7 |
Correct |
4 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
20 ms |
8852 KB |
Output is correct |
3 |
Correct |
20 ms |
8460 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
9 ms |
6100 KB |
Output is correct |
6 |
Correct |
26 ms |
10140 KB |
Output is correct |
7 |
Correct |
4 ms |
4948 KB |
Output is correct |
8 |
Correct |
35 ms |
10536 KB |
Output is correct |
9 |
Correct |
38 ms |
11200 KB |
Output is correct |
10 |
Correct |
74 ms |
13628 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
20 ms |
8852 KB |
Output is correct |
3 |
Correct |
20 ms |
8460 KB |
Output is correct |
4 |
Correct |
2 ms |
4948 KB |
Output is correct |
5 |
Correct |
9 ms |
6100 KB |
Output is correct |
6 |
Correct |
26 ms |
10140 KB |
Output is correct |
7 |
Correct |
4 ms |
4948 KB |
Output is correct |
8 |
Correct |
35 ms |
10536 KB |
Output is correct |
9 |
Correct |
38 ms |
11200 KB |
Output is correct |
10 |
Correct |
74 ms |
13628 KB |
Output is correct |
11 |
Correct |
2 ms |
4948 KB |
Output is correct |
12 |
Correct |
2 ms |
4948 KB |
Output is correct |
13 |
Correct |
2 ms |
4948 KB |
Output is correct |
14 |
Correct |
90 ms |
14824 KB |
Output is correct |
15 |
Correct |
35 ms |
9924 KB |
Output is correct |
16 |
Correct |
54 ms |
12536 KB |
Output is correct |
17 |
Correct |
3 ms |
4948 KB |
Output is correct |
18 |
Correct |
4 ms |
5000 KB |
Output is correct |
19 |
Correct |
3 ms |
4948 KB |
Output is correct |
20 |
Correct |
61 ms |
13908 KB |
Output is correct |
21 |
Correct |
2 ms |
5000 KB |
Output is correct |
22 |
Correct |
2 ms |
4948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
4948 KB |
Output is partially correct |
2 |
Correct |
31 ms |
11180 KB |
Output is correct |
3 |
Partially correct |
51 ms |
15740 KB |
Output is partially correct |
4 |
Partially correct |
54 ms |
16664 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
4948 KB |
Output is partially correct |
2 |
Correct |
31 ms |
11180 KB |
Output is correct |
3 |
Partially correct |
51 ms |
15740 KB |
Output is partially correct |
4 |
Partially correct |
54 ms |
16664 KB |
Output is partially correct |
5 |
Partially correct |
91 ms |
18300 KB |
Output is partially correct |
6 |
Partially correct |
80 ms |
19676 KB |
Output is partially correct |
7 |
Partially correct |
80 ms |
19240 KB |
Output is partially correct |
8 |
Partially correct |
81 ms |
20232 KB |
Output is partially correct |
9 |
Partially correct |
48 ms |
14188 KB |
Output is partially correct |
10 |
Partially correct |
82 ms |
20524 KB |
Output is partially correct |
11 |
Partially correct |
78 ms |
20780 KB |
Output is partially correct |
12 |
Partially correct |
50 ms |
15244 KB |
Output is partially correct |
13 |
Partially correct |
54 ms |
14564 KB |
Output is partially correct |
14 |
Partially correct |
50 ms |
14180 KB |
Output is partially correct |
15 |
Partially correct |
49 ms |
13688 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
5268 KB |
Output is partially correct |
17 |
Partially correct |
42 ms |
13124 KB |
Output is partially correct |
18 |
Partially correct |
41 ms |
13176 KB |
Output is partially correct |
19 |
Partially correct |
52 ms |
13768 KB |
Output is partially correct |
20 |
Partially correct |
62 ms |
16400 KB |
Output is partially correct |
21 |
Partially correct |
69 ms |
18640 KB |
Output is partially correct |
22 |
Partially correct |
55 ms |
15628 KB |
Output is partially correct |