제출 #547312

#제출 시각아이디문제언어결과실행 시간메모리
547312MonarchuwuEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
22 ms372 KiB
/** * Problem: info1cup17_eastereggs - Easter Eggs * Link: https://oj.uz/problem/view/info1cup17_eastereggs * Tags: Interactive **/ #include<iostream> #include<algorithm> #include<vector> #include<queue> #include "grader.h" using namespace std; typedef pair<int, int> pii; #define ff first #define ss second const int N = 600; vector<int> g[N], ord; void dfs(int u, int p) { ord.push_back(u); for (int v : g[u]) if (v != p) dfs(v, u); } int findEgg(int n, vector<pii> bridges) { for (int i = 1; i <= n; ++i) g[i].clear(); for (pii e : bridges) { g[e.ff].push_back(e.ss); g[e.ss].push_back(e.ff); } ord.clear(); dfs(1, 0); int lo(0), hi(n - 2), m; while (lo <= hi) { m = (lo + hi) >> 1; if (query(vector<int>(ord.begin(), ord.begin() + m + 1))) hi = m - 1; else lo = m + 1; } return ord[hi + 1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...