# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671445 | 2022-12-13T05:14:52 Z | dooompy | Easter Eggs (info1cup17_eastereggs) | C++17 | 22 ms | 2712 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> adj[100005]; vector<int> straight; bool able(int m) { vector<int> temp; for(int i = 0; i <= m; ++i) temp.push_back(straight[i]); return query(temp); } void dfs(int node, int par = -1) { straight.push_back(node); for (auto nxt : adj[node]) { if (nxt == par) continue; dfs(nxt, node); } } int findEgg (int N, vector < pair < int, int > > bridges) { straight.clear(); for (int i = 0; i <= N; i++) adj[i].clear(); for (int i = 0; i < bridges.size(); i++) { adj[bridges[i].first].push_back(bridges[i].second); adj[bridges[i].second].push_back(bridges[i].first); } dfs(1); int n = straight.size(); int l = 0, r = n-1; int ans = -1; while(l < r) { int m = (l + r) >> 1; if(able(m)) r = m; else l = m + 1; } return straight[r]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2640 KB | Number of queries: 4 |
2 | Correct | 2 ms | 2640 KB | Number of queries: 4 |
3 | Correct | 2 ms | 2640 KB | Number of queries: 4 |
4 | Correct | 2 ms | 2640 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2640 KB | Number of queries: 8 |
2 | Correct | 13 ms | 2688 KB | Number of queries: 9 |
3 | Correct | 22 ms | 2640 KB | Number of queries: 9 |
4 | Correct | 16 ms | 2700 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 2712 KB | Number of queries: 9 |
2 | Correct | 13 ms | 2640 KB | Number of queries: 9 |
3 | Correct | 19 ms | 2672 KB | Number of queries: 9 |
4 | Correct | 15 ms | 2680 KB | Number of queries: 9 |