# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874288 | 2023-11-16T15:56:07 Z | asli_bg | Easter Eggs (info1cup17_eastereggs) | C++11 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> ord; vector<int> adjlist[550]; void dfs(int i=1, int r=0){ ord.push_back(i); for(auto komsu:adjlist[i]){ if(komsu!=r){ dfs(komsu,i); } } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i=1;i<=N;i++){ adjlist[i].clear(); } ord.clear(); for(auto el:bridges){ int a=bridges.first; int b=bridges.second; adjlist[a].push_back(b); adjlist[b].push_back(a); } dfs(); int l=0; int r=N-1; while(l<(r-1)){ int mid=l+(r-l)/2; if(query(vector<int>(ord.begin(),ord.begin()+mid))) r=mid; else l=mid; } return ord[r]; }