Submission #575413

#TimeUsernameProblemLanguageResultExecution timeMemory
575413spensaEaster Eggs (info1cup17_eastereggs)C++14
80 / 100
16 ms436 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define pb push_back vector<int> G[512]; vector<int> arr; void dfs(int a, int b){ // cout<<"a="<<a<<" "; arr.pb(a); for(auto k: G[a]){ if(k==b) continue; dfs(k,a); } } int findEgg(int N, vector<pair<int,int>> bridges){ for(int i=1; i<=N; i++) G[i].clear(); arr.clear(); for(auto k:bridges){ G[k.first].pb(k.second); G[k.second].pb(k.first); } dfs(1, 0); // for(int i=0; i<N; i++){ // cout<<arr[i]<<" "; // } int l=0, r=N-1, mid; while(l!=r){ mid = l + (r-l)/2; // cout<<mid<<" "; if(query(vector<int>(arr.begin(), arr.begin()+mid+1))){ r = mid; } else l = mid+1; } return arr[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...