# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
835618 | 2023-08-23T16:40:44 Z | VMaksimoski008 | Easter Eggs (info1cup17_eastereggs) | C++14 | 1 ms | 464 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<vector<int> > graph; vector<int> euler; void dfs(int u, int p) { euler.push_back(u); for(int &v : graph[u]) { if(v == p) continue; dfs(v, u); } } int findEgg(int n, vector<pair<int, int> > edges) { graph.clear(); euler.clear(); graph.resize(n+1); for(auto &x : edges) { graph[x.first].push_back(x.second); graph[x.second].push_back(x.first); } dfs(1, 0); int l=0, r=n-1; int ans = 0; while(l <= r) { int mid = (l + r) / 2; vector<int> to_query(euler.begin(), euler.begin() + mid + 1); if(l == r) { ans = 0; break; } if(query(to_query)) { ans = mid; r = mid - 1; } else l = mid + 1; } return euler.back(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 428 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 460 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 464 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |