#include <bits/stdc++.h>
#include "doll.h"
using namespace std;
const int MAXN = 400000;
int n, m, cur = 1, s, x[MAXN], y[MAXN];
vector<int> a;
vector<int> c, x_ans, y_ans;
void dfs(int node, vector<int> v){
cur = max(cur, node);
if(v.size() == 2){
x[node - 1] = v[0];
y[node - 1] = v[1];
return ;
}
x[node - 1] = -node * 2;
y[node - 1] = -(node * 2 + 1);
vector<int> L, R;
for(int i = 0; i < (int)v.size(); ++i){
if(i & 1) R.push_back(v[i]);
else L.push_back(v[i]);
}
dfs(node * 2, L);
dfs(node * 2 + 1, R);
}
void create_circuit(int _m, vector<int> _a){
m = _m; a = _a; n = a.size();
for(int i = 0; i <= m; ++i) c.push_back(-1);
int p = 1;
while(p < n + 1){
p *= 2;
}
for(int i = n + 1; i < p; ++i) a.push_back(-1);
a.push_back(0);
dfs(1, a);
x_ans.resize(cur); y_ans.resize(cur);
for(int i = 0; i < cur; ++i){
x_ans[i] = x[i];
y_ans[i] = y[i];
}
assert(x_ans.size() <= 2 * n);
answer(c, x_ans, y_ans);
}
Compilation message
In file included from /usr/include/c++/10/cassert:44,
from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:33,
from doll.cpp:1:
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:43:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
43 | assert(x_ans.size() <= 2 * n);
| ~~~~~~~~~~~~~^~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
316 KB |
Output is partially correct |
2 |
Partially correct |
78 ms |
14564 KB |
Output is partially correct |
3 |
Partially correct |
77 ms |
14648 KB |
Output is partially correct |
4 |
Partially correct |
82 ms |
15324 KB |
Output is partially correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
316 KB |
Output is partially correct |
2 |
Partially correct |
78 ms |
14564 KB |
Output is partially correct |
3 |
Partially correct |
77 ms |
14648 KB |
Output is partially correct |
4 |
Partially correct |
82 ms |
15324 KB |
Output is partially correct |
5 |
Partially correct |
104 ms |
16340 KB |
Output is partially correct |
6 |
Partially correct |
85 ms |
16148 KB |
Output is partially correct |
7 |
Partially correct |
87 ms |
16264 KB |
Output is partially correct |
8 |
Partially correct |
85 ms |
15984 KB |
Output is partially correct |
9 |
Partially correct |
77 ms |
14652 KB |
Output is partially correct |
10 |
Partially correct |
91 ms |
16040 KB |
Output is partially correct |
11 |
Partially correct |
82 ms |
15764 KB |
Output is partially correct |
12 |
Partially correct |
78 ms |
14880 KB |
Output is partially correct |
13 |
Partially correct |
79 ms |
15172 KB |
Output is partially correct |
14 |
Partially correct |
79 ms |
15136 KB |
Output is partially correct |
15 |
Partially correct |
84 ms |
15244 KB |
Output is partially correct |
16 |
Partially correct |
3 ms |
708 KB |
Output is partially correct |
17 |
Correct |
45 ms |
8344 KB |
Output is correct |
18 |
Partially correct |
79 ms |
14872 KB |
Output is partially correct |
19 |
Partially correct |
78 ms |
14840 KB |
Output is partially correct |
20 |
Partially correct |
84 ms |
15944 KB |
Output is partially correct |
21 |
Partially correct |
86 ms |
15696 KB |
Output is partially correct |
22 |
Partially correct |
90 ms |
15732 KB |
Output is partially correct |