Submission #958798

#TimeUsernameProblemLanguageResultExecution timeMemory
958798LaviniaTornaghiEaster Eggs (info1cup17_eastereggs)C++17
26.40 / 100
18 ms532 KiB
#include<bits/stdc++.h> using namespace std; int query(vector<int> h); int findEgg (int N, vector < pair < int, int > > bridges){ vector<vector<int>> t(N+1); for(auto [a,b]:bridges){ t[a].push_back(b); t[b].push_back(a); } set<int> s; for(int i=1;i<=N;i++) s.insert(i); while(s.size()>1){ vector<bool>vis(N+1); set<int> e; function<void(int)> dfs = [&] (int nd){ vis[nd]=1; if(e.size()<(s.size()/2)) e.insert(nd); else return; for(auto u : t[nd]) if(!vis[u] && s.find(u)!=s.end()) dfs(u); }; dfs(*s.begin()); if(!query(vector(e.begin(), e.end()))){ set<int> m; for(auto x : s) if(e.find(x)==e.end()) m.insert(x); s = m; }else s=e; } return *s.begin(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...