Submission #1197823

#TimeUsernameProblemLanguageResultExecution timeMemory
1197823MateiKing80Mechanical Doll (IOI18_doll)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>

using namespace std;

vector<int> ansX, ansY, ansLegit;
int maxx = 1;

void build(int loc, vector<int> a) {
	if (a.size() % 2 == 1) {
		a.push_back(-1);
		for (int i = a.size() - 1; i; i --)
			swap(a[i], a[i - 1]);
	}
	vector<int> l, r;
	int pos = 0;
	for (auto i : a) {
		(pos ? r : l).push_back(i);
		pos ^= 1;
	}
	if (l.size() == 1)
		ansX[-loc - 1] = l[0];
	else {
		ansX[-loc - 1] = -(++ maxx);
		build(-maxx, l);
	}
	if (r.size() == 1)
		ansY[-loc - 1] = r[0];
	else {
		ansY[-loc - 1] = -(++ maxx);
		build(-maxx, r);
	}
}

void create_circuit(int m, vector<int> a) {
	a.push_back(0);
	ansLegit.resize(m + 1);
	ansX.resize(10 * m);
	ansY.resize(10 * m);
	for (int i = 0; i <= m; i ++)
		ansLegit[i] = -1;
	build(-1, a);
	ansX.resize(maxx);
	ansY.resize(maxx);
	answer(ansLegit, ansX, ansY);
}

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:44:9: error: 'answer' was not declared in this scope
   44 |         answer(ansLegit, ansX, ansY);
      |         ^~~~~~