#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
typedef int64_t ll;
typedef string str;
int findEgg(int n, vector <pair <int, int>> edges) {
vector <int> g[n + 1];
vector <int> path;
for (auto [a, b] : edges) {
g[a].push_back(b);
g[b].push_back(a);
}
function <void(int, int)> dfs = [&](int v, int p) {
path.push_back(v);
for (int to : g[v]) {
if (to == p) {
continue;
}
prepare(to, v);
}
};
dfs(1, -1);
int l = 0, r = n - 1;
while (l < r) {
int mid = (l + r) >> 1;
if (query(vector <int>(path.begin() + l, path.begin() + mid))) {
r = mid;
} else {
l = mid;
}
}
return path[l];
}
Compilation message
eastereggs.cpp: In lambda function:
eastereggs.cpp:22:7: error: 'prepare' was not declared in this scope
22 | prepare(to, v);
| ^~~~~~~