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>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define pb push_back
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll, ll>
using namespace std;
vector<int>graph[513], ord;
void dfs(int node = 1, int par = 0)
{
ord.pb(node);
for(int i : graph[node])
{
if(i != par)
dfs(i, node);
}
}
int findEgg(int N, vector<pair<int, int>> bridges)
{
for(int i = 1; i <= N; i++) graph[i].clear();
ord.clear();
for(pii x : bridges){
graph[x.f].pb(x.s);
graph[x.s].pb(x.f);
}
dfs();
int l = 0, r = N - 1;
while(l != r)
{
int mid = (l + r + 1) / 2;
if(query(vi(ord.begin(), ord.begin() + mid))) r = mid - 1;
else l = mid;
}
return ord[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... |