# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918061 | raul2008487 | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 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"
#define ll long long
#define vl vector<ll>
#define fi first
#define se second
using namespace std;
vl adj[sz];
vl et;
void dfs(ll node, ll p){
et.pb(node);
for(auto edge: adj[node]){
if(edge == p){continue;}
dfs(edge, v);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
ll i, j;
for(i=0;i<bridges.size();i++){
adj[bridges[i].fi].push_back(bridges[i].se);
adj[bridges[i].se].push_back(bridges[i].fi);
}
dfs(1);
ll lo = 0, hi = N - 1, mid, best = 0;
while(lo <= hi){
mid = (lo + hi) >> 1;
vl t;
for(i = lo; i<=mid; i++){
t.pb(et[i]);
}
if(query(t)){
best = mid;
hi = mid - 1;
}
else{
lo = mid + 1;
}
}
cout << best << endl;
}