Submission #1099578

#TimeUsernameProblemLanguageResultExecution timeMemory
1099578ChocoEaster Eggs (info1cup17_eastereggs)C++14
40 / 100
4 ms600 KiB
#include <bits/stdc++.h> #include "grader.h" #define ll long long using namespace std; vector<vector<int>>v(513); vector<int>order; void dfs(int i,int p){ order.push_back(i); for(auto j: v[i]) if(j!=p) dfs(j,i); } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i=0;i<513;i++){ v[i].clear(); } order.clear(); for(int i=0;i<=N-1;i++){ int x=bridges[i].first; int y=bridges[i].second; v[x].push_back(y); v[y].push_back(x); } dfs(1,0); int l=0,r=N-1; while(l!=r){ ll mid=(l+r+1)/2; if(query(vector<int>(order.begin(),order.begin()+mid))) r=mid-1; else l=mid; } return order[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...