#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
int N=-1;
vector<int> X, Y;
int build(vector<int> vec) {
bool fnd = 0;
for(int i : vec)
if(i!=-1) {
fnd = 1;
break;
}
if(!fnd) return -1;
int v = N--;
X.push_back(0);
Y.push_back(0);
if(vec.size()==2) {
X[-v-1] = vec[0];
Y[-v-1] = vec[1];
return v;
}
vector<int> vc[2];
for(int i=0; i<vec.size(); i++)
vc[i&1].push_back(vec[i]);
X[-v-1] = build(vc[0]);
Y[-v-1] = build(vc[1]);
return v;
}
void create_circuit(int M, vector<int> A) {
vector<int> C(M+1, 0);
C[0] = A[0];
fill(C.begin()+1, C.end(), -1);
A.push_back(0);
reverse(A.begin(), A.end());
A.pop_back();
while(A.size()==1 || (1<<__lg(A.size()))!=A.size()) A.push_back(-1);
reverse(A.begin(), A.end());
build(A);
answer(C, X, Y);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |