Submission #522157

# Submission time Handle Problem Language Result Execution time Memory
522157 2022-02-04T01:30:11 Z boykut Easter Eggs (info1cup17_eastereggs) C++14
0 / 100
209 ms 131076 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) {
	vector<int> Q;
	for (int i = 0; i <= len; i++) Q.push_back(vertex[i]);
	return query(Q);
}

int findEgg (int N, vector < pair < int, int > > bridges){
	for (auto it : bridges) {
		g[it.first].push_back(it.second);
		g[it.second].push_back(it.first);
	}
	dfs(1);
	int l = 0, r = vertex.size() - 1;
	while (l < r) {
		int m = (l + r) / 2;
		if (check(m))
			r = m;
		else
			l = m + 1;
	}
	return vertex[r];
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 456 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 209 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 196 ms 131076 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -