# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
61550 | 2018-07-26T07:29:12 Z | FutymyClone | Easter Eggs (info1cup17_eastereggs) | C++14 | 5 ms | 916 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; const int N = 515; vector <int> g[N], level[N]; int n, h[N]; void dfs (int u, int p) { for (int v: g[u]) { if (v == p) continue; h[v] = h[u] + 1; dfs(v, u); } } int findEgg (int N, vector <pair <int, int> > bridges) { n = N; for (auto i: bridges) { g[i.first].push_back(i.second); g[i.second].push_back(i.first); } h[1] = 1; dfs(1, 1); int l = 1; int r = 0; for (int i = 1; i <= n; i++) r = max(r, h[i]); for (int i = 1; i <= n; i++) level[h[i]].push_back(i); vector <int> island, islands; while (l <= r) { int mid = (l + r) / 2; islands.clear(); for (int i = 1; i <= mid; i++) { for (int v: level[i]) { islands.push_back(v); } } if (query(islands)) r = mid - 1; else l = mid + 1; } islands.clear(); for (int i = 1; i <= l; i++) { for (int v: level[i]) { island.push_back(v); } } for (int v: island) { islands.push_back(v); if (query(islands)) return v; islands.clear(); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 760 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 5 ms | 916 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |