# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786782 | 2023-07-18T12:47:10 Z | borisAngelov | Easter Eggs (info1cup17_eastereggs) | C++17 | 220 ms | 131072 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 = 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; while (l <= r) { 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; } } return in_order[l - 1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 220 ms | 131072 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 172 ms | 131072 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 170 ms | 131072 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |