Submission #522031

# Submission time Handle Problem Language Result Execution time Memory
522031 2022-02-03T15:45:35 Z iskhakkutbilim Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 456 KB
#include<bits/stdc++.h>
 #include "grader.h"

using namespace std;

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


int findEgg (int N, vector < pair < int, int > > bridges)
{
	
	for(int i = 1;i <= N; i++){
		g[i].clear();
	}
	island.clear();
	used.resize(N + 2, 0);
	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);
   	//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];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 328 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -