Submission #1031295

#TimeUsernameProblemLanguageResultExecution timeMemory
1031295ArthuroWichEaster Eggs (info1cup17_eastereggs)C++17
0 / 100
219 ms131072 KiB
#include <bits/stdc++.h> #include "grader.h" using namespace std; int n; vector<int> adj[555], arr; void dfs(int i, int p) { arr.push_back(i); for (int j : adj[i]) { if (j == p) { continue; } dfs(j, i); } } int findEgg (int N, vector<pair<int, int>> bridges) { int n = N; for (auto [a, b] : bridges) { adj[a].push_back(b); adj[b].push_back(a); } int l = 1, r = n; dfs(1, -1); while(l < r) { int m = (l+r)/2; vector<int> b; for (int i = 0; i < m; i++) { b.push_back(arr[i]); } if (query(b)) { r = m; } else { l = m+1; } } return arr[l-1]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...