Submission #1136229

#TimeUsernameProblemLanguageResultExecution timeMemory
1136229PetrixEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
0 ms500 KiB
#include "grader.h" #include <bits/stdc++.h> using namespace std; vector<int> a; vector<int> v[513]; int viz[513]; vector<int> aux; void dfs(int nod){ int i; viz[nod]=1; a.push_back(nod); for(i=0;i<v[nod].size();i++){ if(viz[v[nod][i]]==0) dfs(v[nod][i]); } } int findEgg(int n,vector<pair<int,int>> bridges){ int st,dr,rasp,mij,i; for(i=0;i<bridges.size();i++){ v[bridges[i].first].push_back(bridges[i].second); v[bridges[i].second].push_back(bridges[i].first); } dfs(1); return {0}; st=0;dr=a.size()-1; while(st<=dr){ mij=(st+dr)/2;aux.clear(); for(i=0;i<=mij;i++){ aux.push_back(a[i]); } if(query(aux)){ rasp=aux.back();dr=mij-1; }else st=mij+1; } return rasp; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...