Submission #1088206

#TimeUsernameProblemLanguageResultExecution timeMemory
1088206vahagngEaster Eggs (info1cup17_eastereggs)C++17
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int N = 514; vector<vector<int>>comps; vector<int>comp; vector<int>adj[N]; bool visited[N]; void dfs(int node){ visited[node] = true; comp.push_back(node); for(auto i : adj[node]){ if(visited[i]) continue; dfs(i); } } int findEgg (int n, vector < pair < int, int > > bridges) { for(auto i : bridges){ adj[i.first].push_back(i.second); adj[i.second].push_back(i.first); } for(int i = 1; i <= n; i++){ if(!visited[i]){ dfs(i); comps.push_back(comp); comp.clear(); } } vector<int>a; for(auto i : comps){ if(query(i)) { a = i; break; } } for(auto i : a){ if(query({i})) return i; } return N; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...