#undef _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define fi first
#define si second
#define ar array
typedef pair<int,int> pi;
typedef tuple<int,int,int> ti;
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {cerr << " " << to_string(H);debug_out(T...);}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#include "grader.h"
vector<int> adj[520], order;
void dfs(int x, int p) {
order.pb(x);
for (auto i: adj[x]) {
if (i == p) continue;
dfs(i, x);
}
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
order.clear();
for (int i = 1; i <= N; ++i) adj[i].clear();
for (auto i: bridges) {
adj[i.fi].pb(i.si);
adj[i.si].pb(i.fi);
}
dfs(1, -1);
int lo = 0, hi = n + 1;
while (lo + 1 < hi) {
int mid = (lo + hi) / 2;
vector<int> lq;
for (int i = lo + 1; i <= mid; ++i) lq.pb(order[i - 1]);
if (query(lq)) hi = mid;
else lo = mid;
}
return order[hi - 1];
}
Compilation message
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:30:26: error: 'N' was not declared in this scope
30 | for (int i = 1; i <= N; ++i) adj[i].clear();
| ^