# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062195 | 2024-08-16T21:14:25 Z | pera | Easter Eggs (info1cup17_eastereggs) | C++17 | 2 ms | 600 KB |
#include<bits/stdc++.h> #include "grader.h" using namespace std; int findEgg(int N , vector<pair<int , int>> bridges){ vector<int> order; vector<vector<int>> g(N + 1); for(auto [u , v] : bridges){ g[u].push_back(v); g[v].push_back(u); } function<void(int , int)> dfs = [&](int u , int p){ order.emplace_back(u); for(int x = 0;x < (int)g[u].size();x ++){ if(g[u][x] != p){ dfs(g[u][x] , u); } } }; dfs(1 , -1); auto Query = [&](int x , int y){ vector<int> u; for(int i = x;i <= y;i ++){ u.emplace_back(order[i]); } return query(u); }; int l = 0 , r = N - 1 , ans; while(l <= r){ int m = (l + r) / 2; if(Query(l , m)){ ans = order[m]; r = m - 1; }else{ l = m + 1; } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 344 KB | Number of queries: 5 |
2 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 600 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 600 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |