Submission #918122

#TimeUsernameProblemLanguageResultExecution timeMemory
918122vjudge1Easter Eggs (info1cup17_eastereggs)C++17
100 / 100
13 ms1244 KiB
#include <bits/stdc++.h> #include "grader.h" #define pb push_back #define pii pair<int, int> #define pll pair<ll, ll> #define vll vector<ll> #define all(v) v.begin(), v.end() #define whole(a) a+1, a+1+n #define OPT ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define sec second #define fi first #define print(k) cerr << "Ans : "; cout << k << endl; #define ins insert #define pb push_back #define bpc __builtin_popcountll #define skip continue #define endll '\n' #define gcd(a, b) __gcd(a, b) #define lcm(a, b) a*b / (__gcd(a, b)) #define mpr make_pair #define rep(i,l,r) for(ll i=l;i<=r;++i) #define new '\n' typedef long long ll; typedef unsigned long long ull; const int mod = 998244353; const int sz = 3e5+5; using namespace std; int dx[4] = {1,0,-1,0}; int dy[4] = {0,1,0,-1}; vector<int>v; vector<int>g[600]; void dfs(int node, int par) { v.pb(node); for(int i:g[node]) { if(i == par) { continue; } dfs(i, node); } } int findEgg (int n, vector<pair<int, int>> b) { v.clear(); for(int i = 0; i <= n; ++i) { g[i].clear(); } for(pii p:b) { g[p.first].pb(p.second); g[p.second].pb(p.first); } dfs(1, 1); int l = 0, r = v.size()-1; while(l < r) { int mid = ( l + r ) >> 1; vector<int> w; for( int i = 0; i <= mid; ++i){ w.pb(v[i]); } if(query(w)) { r = mid; } else{ l = mid + 1; } } return v[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...