Submission #975438

#TimeUsernameProblemLanguageResultExecution timeMemory
975438Error404Easter Eggs (info1cup17_eastereggs)C++17
100 / 100
12 ms1004 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define pb push_back #define pl pair<ll,int> #define ll long long #define f first #define s second #define pi pair<int,int> const int MAX = 514; vector<int>nodes; vector<int>g[MAX]; void dfs(int u, int p){ nodes.pb(u); for(int i : g[u]){ if(i==p) continue; dfs(i,u); } } int findEgg (int N, vector < pair < int, int > > bridges) { for(int i = 1; i<=N; i++) g[i].clear(); nodes.clear(); for(pi i: bridges){ g[i.f].pb(i.s); g[i.s].pb(i.f); } dfs(1,0); int l = 0, r=N-1; while(l<r){ int m = (l+r+1)/2; bool ans = query(vector<int>(nodes.begin(), nodes.begin()+m)); if(ans){ r = m-1; } else l = m; } //cout << "fsdfd"<< endl; return nodes[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...