#include<bits/stdc++.h>
using namespace std;
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
#define int long long
#define pb push_back
#define fi first
#define se second
typedef pair<double, double> iid;
typedef pair<int, int> ii;
const int N = 600;
const int oo = 9e18 + 2277;
int n, cnt;
int pos[N];
vector<int> vi[N];
void dfs(int pre, int u) {
pos[++cnt] = u;
for(int v: vi[u]) if(v != pre)
dfs(u, v);
}
int findEgg(int num, vector< pair<int, int> > bridges){
cnt = 0; n = num;
for(int i = 1; i <= n; ++i) vi[i].clear();
for(auto v: bridges) {
vi[v.fi].pb(v.se); vi[v.se].pb(v.fi);
}
dfs(1, 1);
int l = 1, r = n;
while(r != l) {
int mid = (l + r) / 2;
vector<int> tmp;
for(int i = 1; i <= mid; ++i) tmp.pb(pos[i]);
if(query(tmp)) r = mid;
else l = mid + 1;
}
return pos[l];
}
Compilation message
eastereggs.cpp: In function 'long long int findEgg(long long int, std::vector<std::pair<long long int, long long int> >)':
eastereggs.cpp:39:12: error: 'query' was not declared in this scope
if(query(tmp)) r = mid;
^~~~~