Submission #360177

# Submission time Handle Problem Language Result Execution time Memory
360177 2021-01-27T15:57:03 Z tengiz05 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
25 ms 748 KB
#include <bits/stdc++.h>
#include "grader.h"
#ifndef EVAL
#include "grader.cpp"
#endif
using namespace std;
const int MAXN = 515;
vector<int> edges[MAXN];
int n;
vector<int> a;
void dfs(int u, int p = -1){
	a.push_back(u);
	for(auto v : edges[u]){
		if(v == p)continue;
		dfs(v,u);
	}
}
int findEgg(int N, vector<pair<int,int>> bridges){
	n = N;
	for(auto [u, v] : bridges){
		edges[u].push_back(v);
		edges[v].push_back(u);
	}dfs(1);
	int l=-1, r=n;
	while(l+1 < r){
		int mid = (l+r)>>1;
		vector<int> toask;
		for(int i=0;i<mid;i++){
			toask.push_back(a[i]);
		}if(query(toask))r = mid;
		else l = mid;
	}
	for(int i=1;i<=n;i++){
		edges[i].clear();
	}a.clear();
	return a[l];
}



# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 364 KB Number of queries: 9
2 Correct 14 ms 364 KB Number of queries: 9
3 Correct 24 ms 492 KB Number of queries: 9
4 Runtime error 9 ms 748 KB Execution killed with signal 6
# Verdict Execution time Memory Grader output
1 Partially correct 25 ms 364 KB Number of queries: 10
2 Correct 19 ms 364 KB Number of queries: 9
3 Runtime error 7 ms 620 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -