# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
97690 | 2019-02-17T18:01:02 Z | KLPP | Easter Eggs (info1cup17_eastereggs) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; typedef pair<int,int> pii; int findEgg (int N, vector < pair < int, int > > bridges) { /*vector<int> nei[N]; int n=N; for(int i=0;i<bridges.size();i++){ nei[bridges[i].first-1].push_back(bridges[i].second-1); nei[bridges[i].second-1].push_back(bridges[i].first-1); } pii dist[n]; for(int i=0;i<n;i++){ dist[i].first=-1; dist[i].second=i; } /*queue<int> q; q.push(0); dist[0].first=0; while(!q.empty()){ int u=q.front();q.pop(); for(int i=0;i<nei[u].size();i++){ int v=nei[u][i]; if(dist[v].first==-1){ dist[v].first=dist[u].first+1; q.push(v); } } } sort(dist,dist+n);*/ for(int i=0;i<n;i++){ vector<int> v; v.push_back(i+1); if(query(v))return i+1; } //for(int i=0;i<n;i++)cout<<dist[i].second<<endl; /*int lo=0; int hi=n; while(hi-lo>1){ int mid=(hi+lo)/2; vector<int> v; for(int i=0;i<mid;i++)v.push_back(dist[i].second+1); if(query(v)){ hi=mid; }else lo=mid; } return lo+1;*/ return 0; }