제출 #1319951

#제출 시각아이디문제언어결과실행 시간메모리
1319951lknijikaijichiEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
1 ms928 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; template <typename T> using vec = vector<T>; #define fi first #define sc second constexpr int maxn = 513; vec<vec<int>> adj(maxn); int timer = 0; vec<int> path(maxn); void dfs(int u, int p) { path[++timer] = u; for (int& v : adj[u]) { if (v != p) dfs(v, u); } } int findEgg (int n, vec<pair<int,int>> edges) { for (auto& edge : edges) { adj[edge.fi].push_back(edge.sc); adj[edge.sc].push_back(edge.fi); } dfs(1, 1); int lo = 1, hi = n; while (lo < hi) { int mid = (lo + hi) >> 1; vec<int> pt; for (int i = 1; i <= mid; ++i) pt.push_back(path[i]); if (query(pt)) hi = mid; else lo = mid + 1; } return path[lo]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...