# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
963103 | biank | Easter Eggs (info1cup17_eastereggs) | C++14 | 14 ms | 988 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int MAX_N = 512;
vector<int> adj[MAX_N], islands;
void dfs(int u, int p = -1) {
islands.push_back(u + 1);
for (int v : adj[u]) {
if (v != p) dfs(v, u);
}
}
int findEgg (int N, vector<pair<int, int>> bridges) {
islands.clear();
for (int i = 0; i < N; i++) adj[i].clear();
for (int i = 0; i < N - 1; i++) {
auto [u, v] = bridges[i];
--u, --v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(0);
int l = 0, r = N;
while (l + 1 < r) {
int m = (l + r) / 2;
if (query(vector<int>(begin(islands), begin(islands) + m))) {
r = m;
} else {
l = m;
}
}
return islands[l];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |