#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
int iter;
vector<int> tab[200004];
pair<int,int> swt[300004];
void build(int v, vector<int> now){
vector<int> sep[2];
for (int i = 0; i<(int)now.size(); i++)sep[i&1].push_back(now[i]);
if (sep[0].size()==1)swt[-v].first=sep[0][0];
else{
swt[-v].first=--iter;
build(iter,sep[0]);
}
if (sep[1].size()==1)swt[-v].second=sep[1][0];
else if (sep[1].size()){
swt[-v].second=--iter;
build(iter,sep[1]);
}
}
void create_circuit(int m, vector<int> a){
a.insert(a.begin(),0);
a.push_back(0);
int n=a.size();
vector<int> trig(m+1,0);
for (int i = 0; i<n-1; i++)tab[a[i]].push_back(a[i+1]);
for (int i = 0; i<=m; i++){
if (tab[i].size()==1)trig[i]=tab[i][0];
else if (tab[i].size()>1){
trig[i]=--iter;
reverse(tab[i].begin(),tab[i].end());
while(__builtin_popcount(tab[i].size())>1)tab[i].push_back(iter);
reverse(tab[i].begin(),tab[i].end());
build(iter,tab[i]);
}
}
vector<int> x(-iter);
vector<int> y(-iter);
for (int i = 1; i+iter<=0; i++){
x[i-1]=swt[i].first;
y[i-1]=swt[i].second;
}
answer(trig,x,y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
16 ms |
9300 KB |
Output is correct |
3 |
Correct |
15 ms |
9040 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
25 ms |
11084 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
16 ms |
9300 KB |
Output is correct |
3 |
Correct |
15 ms |
9040 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
25 ms |
11084 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
37 ms |
12628 KB |
Output is correct |
9 |
Correct |
35 ms |
12872 KB |
Output is correct |
10 |
Correct |
50 ms |
16688 KB |
Output is correct |
11 |
Correct |
2 ms |
4956 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4952 KB |
Output is correct |
2 |
Correct |
16 ms |
9300 KB |
Output is correct |
3 |
Correct |
15 ms |
9040 KB |
Output is correct |
4 |
Correct |
2 ms |
4956 KB |
Output is correct |
5 |
Correct |
7 ms |
6236 KB |
Output is correct |
6 |
Correct |
25 ms |
11084 KB |
Output is correct |
7 |
Correct |
3 ms |
4952 KB |
Output is correct |
8 |
Correct |
37 ms |
12628 KB |
Output is correct |
9 |
Correct |
35 ms |
12872 KB |
Output is correct |
10 |
Correct |
50 ms |
16688 KB |
Output is correct |
11 |
Correct |
2 ms |
4956 KB |
Output is correct |
12 |
Correct |
2 ms |
4956 KB |
Output is correct |
13 |
Correct |
2 ms |
4956 KB |
Output is correct |
14 |
Correct |
75 ms |
19628 KB |
Output is correct |
15 |
Correct |
37 ms |
12360 KB |
Output is correct |
16 |
Correct |
52 ms |
16428 KB |
Output is correct |
17 |
Correct |
2 ms |
4952 KB |
Output is correct |
18 |
Correct |
2 ms |
4952 KB |
Output is correct |
19 |
Correct |
2 ms |
4956 KB |
Output is correct |
20 |
Correct |
57 ms |
17760 KB |
Output is correct |
21 |
Correct |
3 ms |
4952 KB |
Output is correct |
22 |
Correct |
2 ms |
5136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
4956 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
4956 KB |
Output is partially correct |
2 |
Correct |
44 ms |
12688 KB |
Output is correct |
3 |
Partially correct |
78 ms |
19400 KB |
Output is partially correct |
4 |
Partially correct |
93 ms |
18988 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
2 ms |
4956 KB |
Output is partially correct |
2 |
Correct |
44 ms |
12688 KB |
Output is correct |
3 |
Partially correct |
78 ms |
19400 KB |
Output is partially correct |
4 |
Partially correct |
93 ms |
18988 KB |
Output is partially correct |
5 |
Partially correct |
82 ms |
19464 KB |
Output is partially correct |
6 |
Runtime error |
99 ms |
25732 KB |
Execution killed with signal 11 |
7 |
Halted |
0 ms |
0 KB |
- |