#include <bits/stdc++.h>
using namespace std;
int N, cnter = 0;
vector<int> adj[100001];
vector<int> X(400002), Y(400002);
vector<int> C(200002);
void build(int a, int cur, int l, int r){
if(l == r){
X[abs(cur)] = cur;
Y[abs(cur)] = l;
return;
}
if(l == r - 1){
X[abs(cur)] = adj[a][l];
Y[abs(cur)] = adj[a][r];
return;
}
int mid = (l + r) >> 1;
X[abs(cur)] = --cnter;
build(a, cnter, l, mid);
Y[abs(cur)] = --cnter;
build(a, cnter, mid + 1, r);
}
void create_circuit(int M, vector<int> A) {
N = A.size();
for(int i = 0; i < N - 1; i++) adj[A[i]].push_back(A[i + 1]);
adj[A[N - 1]].push_back(0);
C[0] = A[0];
for(int i = 1; i <= M; i++){
if(adj[i].size() == 0) continue;
if(adj[i].size() == 1) C[i] = adj[i][0];
else{
C[i] = --cnter;
build(i, cnter, 0, adj[i].size() - 1);
}
}
vector<int> CA, XA, YA;
for(int i = 1; i <= abs(cnter); i++){
XA.push_back(X[i]); YA.push_back(Y[i]);
}
for(int i = 0; i <= N; i++) CA.push_back(C[i]);
answer(CA, XA, YA);
}
Compilation message
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:45:5: error: 'answer' was not declared in this scope
45 | answer(CA, XA, YA);
| ^~~~~~