# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
683548 | 2023-01-18T17:15:35 Z | JooDdae | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; vector<int> v[1010], l; void dfs(int u, int p) { l.push_back(u); for(auto x : v[u]) if(x != p) dfs(x, u); } int findEgg(int N, vector<pair<int, int>> bridges) { for(auto [x, y] : bridges) v[x].push_back(y), v[y].push_back(x); dfs(1, 0); int L = 1, R = N-1; while(L <= R) { int M = (L+R)/2; if(query(vector<int>(l.begin(), l.begin()+M+1))) L = M+1; else R = M-1; } return l[R]; }