#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
const int inf=2e9;
void create_circuit(int m,vector<int>a)
{
a.push_back(0);
int n=a.size(),sz=1,cnt=0;
while(sz<n)
sz=sz*2,cnt++;
vector<int>ans(sz*2);
vector<int>v(sz);
int i,j=0;
for(i=0;i<sz;i++)
ans[i+sz]=inf;
int aux=0;
for(i=0;i<sz;i++)
v[i]=v[i/2]/2|((i&1)<<(cnt-1));
for(i=0;i<sz;i++){
if (v[i]>=sz-n)
ans[v[i]+sz]=a[j],j++;
else
ans[v[i]+sz]=inf;
}
vector<int>x,y;
for(i=sz-1;i>0;i--)
if (ans[i*2]==inf && ans[i*2+1]==inf)
ans[i]=inf;
else{
ans[i]=--aux;
x.push_back(ans[i*2]);
y.push_back(ans[i*2+1]);
}
for(i=0;i<x.size();i++){
if (x[i]==inf)
x[i]=aux;
if (y[i]==inf)
y[i]=aux;
}
answer(vector<int>(m+1,aux),x,y);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:34:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
34 | for(i=0;i<x.size();i++){
| ~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
38 ms |
4912 KB |
Output is correct |
3 |
Correct |
37 ms |
4652 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
14 ms |
1092 KB |
Output is correct |
6 |
Correct |
51 ms |
5808 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
38 ms |
4912 KB |
Output is correct |
3 |
Correct |
37 ms |
4652 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
14 ms |
1092 KB |
Output is correct |
6 |
Correct |
51 ms |
5808 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
62 ms |
7888 KB |
Output is correct |
9 |
Correct |
63 ms |
8196 KB |
Output is correct |
10 |
Correct |
91 ms |
10400 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
38 ms |
4912 KB |
Output is correct |
3 |
Correct |
37 ms |
4652 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
14 ms |
1092 KB |
Output is correct |
6 |
Correct |
51 ms |
5808 KB |
Output is correct |
7 |
Correct |
1 ms |
204 KB |
Output is correct |
8 |
Correct |
62 ms |
7888 KB |
Output is correct |
9 |
Correct |
63 ms |
8196 KB |
Output is correct |
10 |
Correct |
91 ms |
10400 KB |
Output is correct |
11 |
Correct |
1 ms |
204 KB |
Output is correct |
12 |
Correct |
2 ms |
204 KB |
Output is correct |
13 |
Correct |
1 ms |
204 KB |
Output is correct |
14 |
Correct |
87 ms |
10116 KB |
Output is correct |
15 |
Correct |
56 ms |
7668 KB |
Output is correct |
16 |
Correct |
83 ms |
10028 KB |
Output is correct |
17 |
Correct |
1 ms |
204 KB |
Output is correct |
18 |
Correct |
2 ms |
204 KB |
Output is correct |
19 |
Correct |
1 ms |
204 KB |
Output is correct |
20 |
Correct |
86 ms |
10164 KB |
Output is correct |
21 |
Correct |
2 ms |
204 KB |
Output is correct |
22 |
Correct |
2 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
1 ms |
204 KB |
Output is correct |
7 |
Correct |
2 ms |
204 KB |
Output is correct |
8 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
50 ms |
7412 KB |
Output is correct |
3 |
Correct |
50 ms |
7404 KB |
Output is correct |
4 |
Correct |
90 ms |
9636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
50 ms |
7412 KB |
Output is correct |
3 |
Correct |
50 ms |
7404 KB |
Output is correct |
4 |
Correct |
90 ms |
9636 KB |
Output is correct |
5 |
Correct |
95 ms |
9892 KB |
Output is correct |
6 |
Correct |
80 ms |
9764 KB |
Output is correct |
7 |
Correct |
87 ms |
9768 KB |
Output is correct |
8 |
Correct |
84 ms |
9644 KB |
Output is correct |
9 |
Correct |
51 ms |
7504 KB |
Output is correct |
10 |
Correct |
84 ms |
9624 KB |
Output is correct |
11 |
Correct |
81 ms |
9524 KB |
Output is correct |
12 |
Correct |
63 ms |
7376 KB |
Output is correct |
13 |
Correct |
78 ms |
7504 KB |
Output is correct |
14 |
Correct |
79 ms |
7616 KB |
Output is correct |
15 |
Correct |
57 ms |
7668 KB |
Output is correct |
16 |
Correct |
2 ms |
464 KB |
Output is correct |
17 |
Correct |
48 ms |
6196 KB |
Output is correct |
18 |
Correct |
51 ms |
7516 KB |
Output is correct |
19 |
Correct |
52 ms |
7404 KB |
Output is correct |
20 |
Correct |
77 ms |
9636 KB |
Output is correct |
21 |
Correct |
83 ms |
9544 KB |
Output is correct |
22 |
Correct |
80 ms |
9636 KB |
Output is correct |