/*
A Submission by $%U%$
at time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
*/
#include <bits/stdc++.h>
#include "grader.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:12:0: warning: ignoring #pragma comment [-Wunknown-pragmas]
#pragma comment(linker, "/stack:200000000")
eastereggs.cpp: In function 'int dfs(int)':
eastereggs.cpp:49:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i=0;i<gt[x].size();i++)
~^~~~~~~~~~~~~
eastereggs.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Number of queries: 4 |
2 |
Correct |
5 ms |
384 KB |
Number of queries: 4 |
3 |
Correct |
6 ms |
384 KB |
Number of queries: 4 |
4 |
Correct |
6 ms |
384 KB |
Number of queries: 4 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
384 KB |
Number of queries: 8 |
2 |
Correct |
18 ms |
512 KB |
Number of queries: 9 |
3 |
Correct |
24 ms |
632 KB |
Number of queries: 9 |
4 |
Correct |
21 ms |
632 KB |
Number of queries: 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
616 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |