# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
713032 | 2023-03-21T00:30:40 Z | vjudge1 | Easter Eggs (info1cup17_eastereggs) | C++17 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int maxn = 1010; typedef pair<int,int> ii; #define ff first #define ss second int n; vector <int> question; int dau[maxn],s[maxn]; vector <int> adj[maxn],comp; void dfs(int x, int p) { comp.push_back(x); for (int i:adj[x]) if (i!=p) dfs(i,x); } int findEggs(int N, vector <ii> bridges) { n=N; question.clear(); for (int i=1; i<=n; i++) adj[i].clear(); for (ii i:bridges) { adj[i.ff].push_back(i.ss); adj[i.ss].push_back(i.ff); } dfs(1,1); int l=0; int r=n-1; int ans = -1; while (l<=r) { int mid=(l+r)/2; vector <int> tmp; for (int i=0; i<=mid; i++) tmp.push_back(comp[i]); if (query(tmp)) { ans=mid; r=mid-1; } else l=mid+1; } return comp[ans]; }