답안 #446516

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
446516 2021-07-22T09:14:14 Z ritul_kr_singh Easter Eggs (info1cup17_eastereggs) C++17
92 / 100
26 ms 456 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
 
vector<int> g[513];
int t[512], dfsTimer;
 
void dfs(int u, int p){
	t[dfsTimer++] = u;
	for(int v : g[u]) if(v != p) dfs(v, u);
}
 
int findEgg (int n, vector <pair<int, int>> e){
	for(int i=0; i<n; ++i) g[i+1].clear();
	dfsTimer = 0;
	
	for(auto &[u, v] : e){
		g[u].push_back(v);
		g[v].push_back(u);
	}
 
	dfs(1, 1);
 
	int x = 0;
	for(int y=512; y/=2; ){
		if(x + y <= n){
			vector<int> q(x+y);
			for(int j=0; j<x+y; ++j) q[j] = t[j];
			x += y * !query(q);
		}
	}
 
	return t[x];
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 200 KB Number of queries: 5
2 Partially correct 1 ms 200 KB Number of queries: 5
3 Partially correct 2 ms 200 KB Number of queries: 5
4 Partially correct 1 ms 200 KB Number of queries: 5
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 456 KB Number of queries: 9
2 Correct 14 ms 340 KB Number of queries: 9
3 Correct 26 ms 344 KB Number of queries: 9
4 Correct 19 ms 360 KB Number of queries: 9
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 328 KB Number of queries: 9
2 Correct 14 ms 352 KB Number of queries: 9
3 Correct 19 ms 356 KB Number of queries: 9
4 Correct 23 ms 356 KB Number of queries: 9