Submission #279642

# Submission time Handle Problem Language Result Execution time Memory
279642 2020-08-22T08:54:45 Z MKutayBozkurt Easter Eggs (info1cup17_eastereggs) C++17
0 / 100
4 ms 640 KB
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;

vector<vector<int>> v;
vector<int> ans;

void dfs(int i, int last = -1) {
	ans.emplace_back(i);
	for (auto node : v[i]) {
		if (last == node) continue;
		dfs(node, i);
	}
}

int findEgg(int n, vector<pair<int, int>> bridges) {
	v = vector<vector<int>>(n + 20);
	for (auto node : bridges) {
		v[node.first].emplace_back(node.second);
		v[node.second].emplace_back(node.first);
	}
	dfs(1);
	int l = 0, r = n - 1;
	while (l <= r) {
		int m = (l + r) / 2;
		if (query(vector<int>(ans.begin(), ans.begin() + m + 1))) r = m;
		else l = m;
	}
	return ans[l];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -