# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786788 | 2023-07-18T12:49:53 Z | borisAngelov | Easter Eggs (info1cup17_eastereggs) | C++17 | 19 ms | 464 KB |
#include "grader.h" #include <bits/stdc++.h> using namespace std; const int maxn = 520; int n; vector<int> g[maxn]; vector<int> in_order; void dfs(int node, int par) { in_order.push_back(node); for (auto next_node : g[node]) { if (next_node != par) { dfs(next_node, node); } } } int findEgg(int N, vector<pair<int, int>> edges) { n = N; for (int i = 1; i <= n; ++i) { g[i].clear(); } in_order.clear(); for (int i = 0; i < edges.size(); ++i) { int x = edges[i].first; int y = edges[i].second; g[x].push_back(y); g[y].push_back(x); } dfs(1, -1); int l = 1; int r = n; int cnt = 0; while (l <= r) { ++cnt; int mid = (l + r) / 2; vector<int> ask; for (int i = 0; i < mid; ++i) { ask.push_back(in_order[i]); } if (query(ask) == 1) { r = mid - 1; } else { l = mid + 1; } if (cnt >= log2(n)) { break; } } return in_order[l - 1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Number of queries: 4 |
2 | Correct | 1 ms | 208 KB | Number of queries: 4 |
3 | Correct | 2 ms | 208 KB | Number of queries: 4 |
4 | Correct | 1 ms | 208 KB | Number of queries: 4 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 336 KB | Number of queries: 8 |
2 | Correct | 9 ms | 336 KB | Number of queries: 9 |
3 | Correct | 14 ms | 340 KB | Number of queries: 9 |
4 | Correct | 19 ms | 364 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 464 KB | Number of queries: 9 |
2 | Correct | 17 ms | 336 KB | Number of queries: 9 |
3 | Correct | 13 ms | 360 KB | Number of queries: 9 |
4 | Correct | 13 ms | 336 KB | Number of queries: 9 |