답안 #242993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
242993 2020-06-30T07:07:20 Z NhatMinh0208 Easter Eggs (info1cup17_eastereggs) C++14
100 / 100
27 ms 668 KB
/*
 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[513];
vector<int> lis,gt[513];
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 5 ms 384 KB Number of queries: 4
4 Correct 5 ms 384 KB Number of queries: 4
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 384 KB Number of queries: 8
2 Correct 15 ms 512 KB Number of queries: 9
3 Correct 20 ms 668 KB Number of queries: 9
4 Correct 27 ms 632 KB Number of queries: 9
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 632 KB Number of queries: 9
2 Correct 22 ms 640 KB Number of queries: 9
3 Correct 21 ms 640 KB Number of queries: 9
4 Correct 19 ms 632 KB Number of queries: 9