Submission #1213416

#TimeUsernameProblemLanguageResultExecution timeMemory
1213416Captain_GeorgiaEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
0 ms504 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; int findEgg (int N, vector<pair<int, int>> edges) { vector<int> g[N]; for (auto [u, v] : edges) { -- u; -- v; g[u].push_back(v); g[v].push_back(u); } vector<int> ord; function<void(int, int)> dfs = [&](int si, int pi) -> void { ord.push_back(si); for (auto ti : g[si]) if (ti != pi) { dfs(ti, si); } }; dfs(1, 0); int low = 0, high = N - 1, best = 0; while (low < high) { int mid = (low + high) / 2; vector<int> tmp; for(int i = 0;i <= mid;i ++) tmp.push_back(ord[i]); if (query(tmp) == 1) { high = mid; } else { low = mid + 1; } } return ord[low]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...