답안 #345978

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345978 2021-01-08T20:16:18 Z ahmet Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
242 ms 131076 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
#define ref(a,b,c) for(int (a)=(b);(a)<=(c);++(a))
#define rep(a,b) for(int (a)=0;(a)<(b);++(a))
#define ll long long
#define pb push_back
#define mp make_pair
vector <int> v[550];
vector <int>  euler;
void dfs(int node,int par){
	euler.pb(node);
	for(int i=0;i<v[node].size();++i){
		int nxt=v[node][i];
		if(nxt==par)continue;
		dfs(nxt,node);
		euler.pb(node);
	}
	return;
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
	for(int i=0;i<N-1;++i){
		int x=bridges[i].first;
		int y=bridges[i].second;
		v[x].pb(y);
		v[y].pb(x);
	}
	dfs(1,0);
	int l=0,r=euler.size()-1;
	while(l!=r){
		int mid=(l+r)/2;
		set <int> s;
		vector <int > tmp;
		for(int i=l;i<=mid;++i)s.insert(euler[i]);
		set <int> ::iterator it=s.begin();
		for(it=s.begin();it!=s.end();++it)tmp.pb(*it);
		if(query(tmp))r=mid;
		else l=mid+1;
	}
	return euler[l];

}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:13:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |  for(int i=0;i<v[node].size();++i){
      |              ~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 9 ms 2656 KB Execution killed with signal 6 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 242 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 238 ms 131076 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -