# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
622444 | Hanksburger | Easter Eggs (info1cup17_eastereggs) | C++17 | 21 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"
#include <bits/stdc++.h>
using namespace std;
vector<int> adj[515], vec, tmp;
void dfs(int x, int p)
{
vec.push_back(x);
for (int y:adj[x])
if (y!=p)
dfs(y, x);
}
int findEgg(int n, vector<pair<int, int> > edge)
{
for (int i=1; i<=n; i++)
adj[i].clear();
for (int i=0; i<edge.size(); i++)
{
int x=edge[i].first, y=edge[i].second;
adj[x].push_back(y);
adj[y].push_back(x);
}
vec.clear();
dfs(1, 1);
int l=0, r=n-1;
while (l<r)
{
int m=(l+r)/2;
tmp.clear();
for (int i=0; i<=m; i++)
tmp.push_back(vec[i]);
if (query(tmp))
r=m;
else
l=m+1;
}
return vec[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... |