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;
#define pb push_back
#define pl pair<ll,int>
#define ll long long
#define f first
#define s second
#define pi pair<int,int>
const int MAX = 514;
vector<int>nodes;
vector<int>g[MAX];
void dfs(int u, int p){
nodes.pb(u);
for(int i : g[u]){
if(i==p) continue;
dfs(i,u);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for(int i = 1; i<=N; i++) g[i].clear();
nodes.clear();
for(pi i: bridges){
g[i.f].pb(i.s);
g[i.s].pb(i.f);
}
dfs(1,0);
int l = 0, r=N-1;
while(l<r){
int m = (l+r+1)/2;
bool ans = query(vector<int>(nodes.begin(), nodes.begin()+m));
if(ans){
r = m-1;
}
else l = m;
}
//cout << "fsdfd"<< endl;
return nodes[l];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |