#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> c, x, y;
int b[400005];
void recur(int l, int r, int p, bool q)
{
if (b[r]<0 || l==r)
{
if (q)
y[p-1]=b[r];
else
x[p-1]=b[r];
return;
}
x.push_back(0);
y.push_back(0);
int num=x.size();
if (q)
y[p-1]=-num;
else
x[p-1]=-num;
int mid=(l+r)/2;
recur(l, mid, num, 0);
recur(mid+1, r, num, 1);
}
void create_circuit(int m, vector<int> a)
{
a.push_back(0);
x.push_back(0);
y.push_back(0);
int sz=a.size();
int loog=log2(sz-0.5)+1;
int power=(1<<loog);
int cnt=0;
for (int i=0; i<power; i++)
{
int cur=0;
for (int j=0; j<loog; j++)
if (i&(1<<j))
cur+=(1<<(loog-j-1));
if (cur>=power-sz)
{
b[cur]=a[cnt];
cnt++;
}
else
b[cur]=-1;
}
recur(0, power/2-1, 1, 0);
recur(power/2, power-1, 1, 1);
for (int i=0; i<=m; i++)
c.push_back(-1);
answer(c, x, y);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
34 ms |
5244 KB |
Output is correct |
3 |
Correct |
31 ms |
5096 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1612 KB |
Output is correct |
6 |
Correct |
45 ms |
7060 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
34 ms |
5244 KB |
Output is correct |
3 |
Correct |
31 ms |
5096 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1612 KB |
Output is correct |
6 |
Correct |
45 ms |
7060 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
58 ms |
8684 KB |
Output is correct |
9 |
Correct |
61 ms |
9068 KB |
Output is correct |
10 |
Correct |
78 ms |
12664 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
34 ms |
5244 KB |
Output is correct |
3 |
Correct |
31 ms |
5096 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
9 ms |
1612 KB |
Output is correct |
6 |
Correct |
45 ms |
7060 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
58 ms |
8684 KB |
Output is correct |
9 |
Correct |
61 ms |
9068 KB |
Output is correct |
10 |
Correct |
78 ms |
12664 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
0 ms |
308 KB |
Output is correct |
13 |
Correct |
0 ms |
212 KB |
Output is correct |
14 |
Correct |
78 ms |
12420 KB |
Output is correct |
15 |
Correct |
53 ms |
8152 KB |
Output is correct |
16 |
Correct |
79 ms |
11928 KB |
Output is correct |
17 |
Correct |
1 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
308 KB |
Output is correct |
20 |
Correct |
75 ms |
12436 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
49 ms |
6996 KB |
Output is correct |
3 |
Correct |
51 ms |
7032 KB |
Output is correct |
4 |
Correct |
68 ms |
10132 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
49 ms |
6996 KB |
Output is correct |
3 |
Correct |
51 ms |
7032 KB |
Output is correct |
4 |
Correct |
68 ms |
10132 KB |
Output is correct |
5 |
Correct |
76 ms |
11700 KB |
Output is correct |
6 |
Correct |
77 ms |
11256 KB |
Output is correct |
7 |
Correct |
70 ms |
11280 KB |
Output is correct |
8 |
Correct |
74 ms |
10904 KB |
Output is correct |
9 |
Correct |
49 ms |
6992 KB |
Output is correct |
10 |
Correct |
72 ms |
10792 KB |
Output is correct |
11 |
Correct |
69 ms |
10464 KB |
Output is correct |
12 |
Correct |
51 ms |
7220 KB |
Output is correct |
13 |
Correct |
53 ms |
7628 KB |
Output is correct |
14 |
Correct |
52 ms |
7824 KB |
Output is correct |
15 |
Correct |
57 ms |
7920 KB |
Output is correct |
16 |
Correct |
2 ms |
468 KB |
Output is correct |
17 |
Correct |
43 ms |
7108 KB |
Output is correct |
18 |
Correct |
51 ms |
7168 KB |
Output is correct |
19 |
Correct |
54 ms |
7308 KB |
Output is correct |
20 |
Correct |
68 ms |
10712 KB |
Output is correct |
21 |
Correct |
74 ms |
10412 KB |
Output is correct |
22 |
Correct |
68 ms |
10512 KB |
Output is correct |