Submission #480532

#TimeUsernameProblemLanguageResultExecution timeMemory
480532HaidaraEaster Eggs (info1cup17_eastereggs)C++17
100 / 100
21 ms456 KiB
#include<bits/stdc++.h> #include<grader.h> #define ff first #define ss second #define rep(i,x,n) for(int i=x;i<n;i++) #define FOR(i,n) rep(i,0,n) using namespace std; const int maxn=550; vector<int>graph[maxn],ord; void dfs(int st=1,int par=-1) { ord.push_back(st); for(auto i:graph[st]) { if(i==par) continue; dfs(i,st); } } bool go=1; int findEgg(int n,vector< pair<int,int> >edges) { if(go){ for(auto i:edges) { graph[i.ff].push_back(i.ss); graph[i.ss].push_back(i.ff); } dfs(); go=0;} int l=0,r=n-1; while(l<r) { int mid=l+(r-l)/2; if(query(vector<int>(ord.begin(),ord.begin()+mid+1))) r=mid; else l=mid+1; } return ord[r]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...