# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918352 | Ferid20072020 | Easter Eggs (info1cup17_eastereggs) | C++17 | 12 ms | 10052 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;
const int up = 2e5 + 5;
vector<int> g[up];
vector<int> List;
void DFS(int node , int from){
List.push_back(node);
for(auto to : g[node]){
if(to != from){
DFS(to , node);
}
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
List.clear();
int i;
for(i=0 ; i<up ; i++){
g[i].clear();
}
for(i=0 ; i<bridges.size() ; i++){
int u = bridges[i].first;
int v = bridges[i].second;
g[bridges[i].first].push_back(bridges[i].second);
g[bridges[i].second].push_back(bridges[i].first);
}
DFS(1 , 0);
int l = 0 , r = N - 1 , mid;
while(l < r){
mid = (l + r) / 2;
vector<int> c;
for(i=l ; i<=mid ; i++){
c.push_back(List[i]);
}
if(query(c) == 1){
r = mid;
}
else{
l = mid + 1;
}
}
return List[l];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |