답안 #360178

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
360178 2021-01-27T15:57:50 Z tengiz05 Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
26 ms 620 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;
	}
	int ans = a[l];
	for(int i=1;i<=n;i++){
		edges[i].clear();
	}a.clear();
	return ans;
}



# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 492 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 364 KB Number of queries: 9
2 Correct 15 ms 364 KB Number of queries: 9
3 Correct 22 ms 364 KB Number of queries: 9
4 Runtime error 8 ms 620 KB Execution killed with signal 6
# 결과 실행 시간 메모리 Grader output
1 Partially correct 26 ms 492 KB Number of queries: 10
2 Correct 19 ms 364 KB Number of queries: 9
3 Runtime error 8 ms 620 KB Execution killed with signal 6
4 Halted 0 ms 0 KB -