답안 #649413

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
649413 2022-10-10T07:45:50 Z elif Easter Eggs (info1cup17_eastereggs) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
// #include "grader.h"
#include "grader.cpp"
using namespace std;

vector<int> adj[513];
vector<int> v;

void dfs(int u, int p){
	v.push_back(u);
	for(auto x : adj[u]){
		if(x != p)
			dfs(x, u);
	}
}
int findEgg(int N, vector<pair<int, int>> bridges){

	for(int i=0; i<N-1; i++){
		int u = bridges[i].first;
		int v = bridges[i].second;
		adj[u].push_back(v);
		adj[v].push_back(u);
	}

	dfs(1, 0);

	int ans = 0;
	int l = 0, r = v.size() - 1;
	while(l <= r){
		vector<int> islands;
		int mid = (l + r) / 2;
		for(int i=0; i<=mid; i++)
			islands.push_back(v[i]);
		int q = query(islands);
		if(q == 1){
			ans = v[mid];
			r = mid - 1;
		}
		else
			l = mid + 1;
	}
	return ans;
}

Compilation message

/usr/bin/ld: /tmp/ccl7JZKa.o: in function `query(std::vector<int, std::allocator<int> >)':
grader.cpp:(.text+0x0): multiple definition of `query(std::vector<int, std::allocator<int> >)'; /tmp/cc8e7Gjc.o:eastereggs.cpp:(.text+0x50): first defined here
/usr/bin/ld: /tmp/ccl7JZKa.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc8e7Gjc.o:eastereggs.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status