/*
A Submission by $%U%$
at time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define rep(i,n) for(int64_t i=0;i < (int64_t)(n);i++)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define FILE_IN "nim.in"
#define FILE_OUT "nim.out"
#define ofile freopen(FILE_IN,"r",stdin);freopen(FILE_OUT,"w",stdout)
#define fio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define nfio cin.tie(0);cout.tie(0)
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
#define ord(a,b,c) ((a>=b)and(b>=c))
#define MOD (ll(1000000007))
#define MAX 300001
#define mag 320
#define p1 first
#define p2 second.first
#define p3 second.second
#define fi first
#define se second
#define pow2(x) (ll(1)<<x)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define piii pair<int,pii>
#define For(i,__,___) for(int i=__;i<=___;i++)
#define Rep(i,__,___) for(int i=__;i>=___;i--)
#define ordered_set tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update>
#define bi BigInt
#define pi 3.1415926535897
typedef long long ll;
//------------xúc xích normie tám muoi tám phan tram não----------//
ll n,m,k,t,t1,i,j,minn,maxx,cur,lu,lv;
int used[501];
vector<int> lis,gt[501];
int dfs(int x)
{
used[x]=1;
lis.push_back(x);
for (int i=0;i<gt[x].size();i++)
if (!used[gt[x][i]]) dfs(gt[x][i]);
}
int bs(int l, int r)
{
if (l==r) return l;
int mid=(l+r)/2;
vector<int> payload;
for (int i=0;i<=mid;i++) payload.push_back(lis[i]);
if query(payload) return bs(l,mid); else return bs(mid+1,r);
}
int findEgg (int N, vector<pii> e)
{
n=N;
for (i=1;i<n;i++) gt[e[i-1].fi].push_back(e[i-1].se),gt[e[i-1].se].push_back(e[i-1].fi);
dfs(1);
return lis[bs(0,n-1)];
}
Compilation message
eastereggs.cpp:11:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/stack:200000000")
eastereggs.cpp: In function 'int dfs(int)':
eastereggs.cpp:48:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0;i<gt[x].size();i++)
~^~~~~~~~~~~~~
eastereggs.cpp:50:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
eastereggs.cpp: In function 'int bs(int, int)':
eastereggs.cpp:57:5: error: expected '(' before 'query'
if query(payload) return bs(l,mid); else return bs(mid+1,r);
^~~~~
eastereggs.cpp:57:38: error: 'else' without a previous 'if'
if query(payload) return bs(l,mid); else return bs(mid+1,r);
^~~~