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;
int cnt=0;
vector<vector<int>> g;
vector<int> a;
void dfs(int v,int prev){
a.push_back(v);
for(auto x:g[v]){
if(x==prev){
continue;
}
dfs(x,v);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
g.resize(N+1);
for(auto x:bridges){
g[x.first].push_back(x.second);
g[x.second].push_back(x.first);
}
dfs(1,-1);
int l= 0,r=N - 1;
while(l<r){
int mid=(l+r)/2;
vector<int> b;
for(int i=0;i<=mid;i++){
b.push_back(a[i]);
}
if(query(b)){
r=mid;
}
else{
l=mid+1;
}
}
return a[r];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |