Submission #403590

#TimeUsernameProblemLanguageResultExecution timeMemory
403590hltkEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
24 ms468 KiB
#include <bits/stdc++.h> using namespace std; #include "grader.h" int findEgg(int n, vector<pair<int, int>> bridges) { vector<vector<int>> g(n + 1); for (auto [a, b] : bridges) { g[a].push_back(b); g[b].push_back(a); } vector<int> ord; function<void(int, int)> dfs = [&](int v, int p) { ord.push_back(v); for (int u : g[v]) { if (u == p) continue; dfs(u, v); } }; dfs(1, -1); int l = 0, r = (int) ord.size() - 1; while (l < r) { int m = (l + r) / 2; if (query({ord.begin(), ord.begin() + m + 1})) r = m; else l = m + 1; } return ord[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...