#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
/*
static int N, X, cntQ;
static vector < int > v[1009];
int query (vector < int > h)
{
cntQ ++;
int ap[1009];
if (h.empty ()) return 0;
for (int i=1; i<=N; i++)
ap[i] = 0;
for (auto it = h.begin (); it != h.end (); it ++)
ap[*it] = 1;
queue < int > cc;
cc.push (h[0]), ap[h[0]] = 2;
while (!cc.empty ())
{
int nod = cc.front ();
cc.pop ();
for (auto it = v[nod].begin (); it != v[nod].end (); it ++)
if (ap[*it] == 1)
ap[*it] = 2, cc.push (*it);
}
for (int i=1; i<=N; i++)
if (ap[i] == 1) return -1;
for (auto it = h.begin (); it != h.end (); it ++)
if (*it == X) return 1;
return 0;
}
*/
#define st first
#define nd second
#define pb push_back
int H[550];
int findEgg(int n, vector < pair < int, int > > edge){
vector < int > V[550],vv;
int i,j,x,l,m,r;
for(i=0;i<n-1;i++){
V[ edge[i].st ].pb(edge[i].nd);
V[ edge[i].nd ].pb(edge[i].st);
}
queue < int > Q;
Q.push(1);
memset(H,0,sizeof H);
for(; Q.size() ; ){
x = Q.front();
Q.pop();
if(H[x]) continue;
H[x] = 1;
vv.pb(x);
for(auto y : v[x])
Q.push(y);
}
l=0; r = n-1;
for(; l < r ;){
m = l+r >> 1;
vector < int > tt;
for(j=0;j<=m;j++) tt.pb(vv[j]);
if(query(tt)) r = m;
else l = m+1;
}
//cout << vv[l] << " ss\n";
return vv[l];
}
/*
int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);
scanf ("%d", &N);
int Queries;
vector < pair < int, int > > param;
for (int i=1; i<N; i++)
{
int x, y;
scanf ("%d %d", &x, &y);
v[x].push_back (y);
v[y].push_back (x);
param.push_back ({x, y});
}
scanf ("%d", &Queries);
while (Queries --)
{
scanf ("%d", &X), cntQ = 0;
int Y = findEgg (N, param);
if (X != Y)
{
printf ("WA %d instead of %d\n", Y, X);
return 0;
}
printf ("OK %d\n", cntQ);
}
return 0;
}
*/
Compilation message
eastereggs.cpp: In function 'int findEgg(int, std::vector<std::pair<int, int> >)':
eastereggs.cpp:55:22: error: 'v' was not declared in this scope
for(auto y : v[x])
^
eastereggs.cpp:60:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
m = l+r >> 1;
~^~