답안 #522033

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522033 2022-02-03T15:50:50 Z iskhakkutbilim Easter Eggs (info1cup17_eastereggs) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
 #include "grader.h"

using namespace std;

vector<int> g[515];

vector<int> island;
void dfs(int v, int par){
	used[v] = 1;
	for(auto to : g[v]){
		if(to == par) continue;
			dfs(to, v);
		
	}
}


int findEgg (int N, vector < pair < int, int > > bridges)
{
	
	for(int i = 1;i <= N; i++){
		g[i].clear();
	}
	island.clear();
	for(int i = 0;i < N-1; i++){
		int a = bridges[i].first;
		int b = bridges[i].second;
		g[a].push_back(b);
		g[b].push_back(a);
	}
   	dfs(1, -1);
   	//cout << 't';
   	// for(auto x : qu){
		// cout << x << " ";
	// }
	// cout << "\n";
//    	
	int l = 0, r = island.size()-1;
	while(r > l){
		int m = (l + r) / 2;
		vector<int> st;
		for(int i = 0;i <= m; i++){
			st.push_back(island[i]);
		}
		if(query(st)){
			r = m;
		}else l = m + 1;
	}
   	return island[l];
}

Compilation message

eastereggs.cpp: In function 'void dfs(int, int)':
eastereggs.cpp:10:2: error: 'used' was not declared in this scope
   10 |  used[v] = 1;
      |  ^~~~