Submission #115996

# Submission time Handle Problem Language Result Execution time Memory
115996 2019-06-10T07:01:03 Z ntrung03 Easter Eggs (info1cup17_eastereggs) C++17
87 / 100
31 ms 512 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;
vector<int> tour;
vector<vector<int>> adj;
void dfs(int u,int e){
	tour.push_back(u);
	for(auto v:adj[u])
	if(v!=e) dfs(v,u);
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
	tour.clear();
	adj.clear();
	adj.resize(N+1);
	for(auto e:bridges){
		adj[e.first].push_back(e.second);
		adj[e.second].push_back(e.first);
	}
	dfs(1,-1);
	int r = 0;
	for(int i=log2(N);i>=0;i--){
		int t = r|(1<<i);
		if(t>N) continue;
		vector<int> q(tour.begin(),next(tour.begin(),t));
//		cout<<t<<endl;
		if(!query(q)) r=t;
	}
//	cout<<tour[r]<<endl;
	return tour[r];
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 512 KB Number of queries: 5
2 Incorrect 3 ms 256 KB Number of queries: 5
3 Incorrect 3 ms 256 KB Number of queries: 5
4 Incorrect 3 ms 384 KB Number of queries: 5
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Number of queries: 9
2 Correct 10 ms 384 KB Number of queries: 9
3 Correct 14 ms 364 KB Number of queries: 9
4 Correct 18 ms 384 KB Number of queries: 9
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 256 KB Number of queries: 10
2 Incorrect 19 ms 384 KB Number of queries: 10
3 Incorrect 19 ms 256 KB Number of queries: 10
4 Incorrect 20 ms 384 KB Number of queries: 10