답안 #522159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
522159 2022-02-04T01:36:38 Z boykut Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
1 ms 584 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

vector<int> g[555];
vector<int> vertex;

void dfs(int v, int p = -1) {
	vertex.push_back(v);
	for (auto to : g[v]) {
		if (to != p) {
			dfs(to, v);
		}
	}
}

int check(int len) {
}

int findEgg (int N, vector < pair < int, int > > bridges){
	vector<vector<int>> g(N);
	vector<int> vertex;
	for (auto it : bridges) {
		g[it.first - 1].push_back(it.second - 1);
		g[it.second - 1].push_back(it.first - 1);
	}
	function<void(int,int)> dfs = [&](int v, int p) {
		vertex.push_back(v);
		for (int to : g[v]) {
			if (to != p) {
				dfs(to, v);
				vertex.push_back(v);
			}
		}
	};
	dfs(0, -1);
	int l = 0, r = vertex.size() - 1;
	while (l < r) {
		int m = (l + r) / 2;
		vector<int> Q;
		for (int i = l; i <= m; i++) Q.push_back(vertex[i] + 1);
		if (query(Q) == 1)
			r = m;
		else
			l = m + 1;
	}
	return vertex[r] + 1;
}

Compilation message

eastereggs.cpp: In function 'int check(int)':
eastereggs.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 464 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 584 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -