# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703958 | boyliguanhan | Easter Eggs (info1cup17_eastereggs) | C++17 | 22 ms | 464 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 "grader.h"
using namespace std;
vector<int> order;
vector<int> adj[513];
void dfs(int n, int p) {
order.push_back(n);
for (auto i : adj[n])
if (i != p)
dfs(i, n);
}
int findEgg(int N, vector < pair < int, int > > bridges)
{
order.clear();
for (int i = 1; i <= N; i++)
adj[i].clear();
for (auto i : bridges)
adj[i.first].push_back(i.second), adj[i.second].push_back(i.first);
dfs(1, 0);
int l = 1, r = N;
while (l < r) {
int mid = l + r >> 1;
if (query(vector<int>(order.begin(), order.begin() + mid)))
r = mid;
else
l = mid + 1;
}
return order[l - 1];
}
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... |