Submission #895620

#TimeUsernameProblemLanguageResultExecution timeMemory
895620maxFedorchukEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
11 ms1872 KiB
#include <bits/stdc++.h> #include "grader.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(int i=1;i<=N;i++) v[i].clear(); for(auto [x, y] : bridges) v[x].push_back(y), v[y].push_back(x); dfs(1, 0); int L = 0, R = N-2; while(L <= R) { int M = (L+R)/2; if(query(vector<int>(l.begin(), l.begin()+M+1))) R = M-1; else L = M+1; } return l[L]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...