Submission #918369

#TimeUsernameProblemLanguageResultExecution timeMemory
918369HaciyevAlikEaster Eggs (info1cup17_eastereggs)C++14
0 / 100
1 ms488 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int mx=550; vector<int> g[mx]; int a[mx],t; void dfs(int u,int p) { a[++t]=u; for(int v:g[u]) { if(v!=p) dfs(v,u); } } int findEgg(int N,vector<pair<int,int>> bridges){ for(pair<int,int> i : bridges) { int u=i.first,v=i.second; g[u].push_back(v); g[v].push_back(u); } dfs(1,0); int l=1,r=N; while(l<=r) { int mid=(l+r)/2; vector<int> temp; for(int i=l;i<=mid;++i) { temp.push_back(a[i]); } if(query(temp)) { r=mid-1; } else { l=mid+1; } } return a[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...