Submission #579126

#TimeUsernameProblemLanguageResultExecution timeMemory
579126Jarif_RahmanEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
26 ms388 KiB
#include "grader.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int findEgg(int n, vector<pair<int, int>> bridges){ vector<vector<int>> v(n); for(auto [a, b]: bridges) a--, b--, v[a].pb(b), v[b].pb(a); vector<int> dfs_array; function<void(int, int)> dfs = [&](int nd, int ss){ dfs_array.pb(nd+1); for(int x: v[nd]) if(x != ss) dfs(x, nd); }; dfs(0, -1); int a = 0, b = n-1; while(a < b){ int md = (a+b)/2; if(query(vector<int>(dfs_array.begin(), dfs_array.begin()+md+1))) b = md; else a = md+1; } return dfs_array[a]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...