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;
const int N = 514;
vector<vector<int>>comps;
vector<int>comp;
vector<int>adj[N];
bool visited[N];
void dfs(int node){
visited[node] = true;
comp.push_back(node);
for(auto i : adj[node]){
if(visited[i]) continue;
dfs(i);
}
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
for(auto i : bridges){
adj[i.first].push_back(i.second);
adj[i.second].push_back(i.first);
}
for(int i = 1; i <= n; i++){
if(!visited[i]){
dfs(i);
comps.push_back(comp);
comp.clear();
}
}
vector<int>a;
for(auto i : comps){
if(query(i)) {
a = i;
break;
}
}
for(auto i : a){
if(query({i})) return i;
}
return N;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |