# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
95351 | dalgerok | Easter Eggs (info1cup17_eastereggs) | C++14 | 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"
using namespace std;
vector < int > q, g[10000];
void dfs(int v, int pr = -1){
q.push_back(v);
for(int to : g[v]){
if(to != pr){
dfs(to, v);
}
}
}
int FindEdgge(int N, vector < pair < int, int > > bridges){
q.clear();
for(int i = 1; i <= N; i++){
g[i].clear();
}
for(auto it : bridges){
g[it.first].push_back(it.second);
g[it.second].push_back(it.first);
}
dfs(1);
int l = 1, r = N;
while(l < r){
int mid = (r + l) >> 1;
if(query(vector < int >(q.begin(), q.begin() + mid))){
r = mid;
}
else{
l = mid + 1;
}
}
return q[l - 1];
}