Submission #1116800

#TimeUsernameProblemLanguageResultExecution timeMemory
1116800SofiatpcEaster Eggs (info1cup17_eastereggs)C++14
0 / 100
187 ms131072 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int MAXN = 520; vector<int> adj[MAXN], v; void dfs(int s, int p){ v.push_back(s); for(int viz : adj[s]) if(viz != p)dfs(viz,s); } int findEgg (int n, vector < pair < int, int > > bridges) { for(int i = 0; i < n-1; i++){ adj[bridges[i].first].push_back(bridges[i].second); adj[bridges[i].second].push_back(bridges[i].first); } dfs(1,0); int l = 0, r = n-1; while(l != r){ int mid = (l+r)/2; vector<int> temp; for(int i = 0; i <= mid; i++)temp.push_back(v[i]); if(query(temp) == 1)r = mid; else l = mid+1; } return v[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...