Submission #983647

#TimeUsernameProblemLanguageResultExecution timeMemory
983647voidpoint11Easter Eggs (info1cup17_eastereggs)C++14
100 / 100
13 ms1256 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; typedef long long ll; vector<int> g[1010], ans; void dfs(int u, int p) { ans.push_back(u); for (auto &v : g[u]) if (v != p) dfs(v, u); } int findEgg (int n, vector<pair<int, int>> bridges) { for (int i = 1; i <= n; i++) g[i].clear(); for (auto &i : bridges) g[i.first].push_back(i.second), g[i.second].push_back(i.first); dfs(1, 0); int l = 0, r = n - 2; while (l <= r) { int m = (l + r) / 2; if (query(vector<int>(ans.begin(), ans.begin() + m + 1))) r = m - 1; else l = m + 1; } return ans[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...