Submission #243017

#TimeUsernameProblemLanguageResultExecution timeMemory
243017daongochaEaster Eggs (info1cup17_eastereggs)C++14
100 / 100
23 ms384 KiB
#include <bits/stdc++.h> #include "grader.h" #define For(i,a,b) for (int i = a; i <= (b); i++) #define For2(i,a,b) for (int i = a; i >= (b); i--) #define pii pair<int, int> #define pb push_back #define PI 3.1415926535897932384626433832795 #define MOD 1000000007 #define INF 2147483647 #define EPS 1e-9 #define fi first #define se second //f#define FILEOPEN using namespace std; vector<int> path[515]; vector<int> passed; void dfs(int u, int prev) { passed.pb(u); for (int v: path[u]) { if (v == prev) continue; dfs(v, u); } } int findEgg(int n, vector<pii> bridges) { For(i,1,n) path[i].clear(); for (pii a: bridges) { path[a.fi].pb(a.se); path[a.se].pb(a.fi); } passed.clear(); passed.pb(0); dfs(1, 1); int l = 1, r = n; while (l < r) { int mid = (l + r) / 2; vector<int> a; For(i,1,mid) a.pb(passed[i]); if (query(a)) r = mid; else l = mid + 1; } return passed[l]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...