제출 #1127137

#제출 시각아이디문제언어결과실행 시간메모리
1127137ChocoEaster Eggs (info1cup17_eastereggs)C++20
0 / 100
1 ms444 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; #define ll long long #define ff first #define ss second #define pb push_back vector<vector<ll>>g; vector<ll>check,order; void dfs(ll node){ check[node]=1; for(ll i:g[node]){ if(!check[node]) dfs(node); } order.pb(node); } int findEgg (int n, vector < pair < int, int > > bridges) { g.resize(n+10); for(ll i=0;i<n;i++){ g[bridges[i].ff].pb(bridges[i].ss); g[bridges[i].ss].pb(bridges[i].ff); } reverse(order.begin(),order.end()); check.resize(n+10); dfs(1); ll l=0,r=n-1; while(l<r){ ll mid=(l+1+r)/2; if(query(vector<int>(order.begin(),order.begin()+mid))) r=mid-1; else l=mid; } return order[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...