# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
918108 | 2024-01-29T13:09:52 Z | raul2008487 | Easter Eggs (info1cup17_eastereggs) | C++17 | 8 ms | 10052 KB |
#include <bits/stdc++.h> #include "grader.h" #define ll int #define vl vector<ll> #define fi first #define se second #define pb push_back using namespace std; const int sz = 2e5+5; vl adj[sz]; vl et; void dfs(ll node, ll p){ et.pb(node); for(auto edge: adj[node]){ if(edge == p){continue;} dfs(edge, node); } } int findEgg (int N, vector < pair < int, int > > bridges) { ll i, j; for(i=0;i<sz;i++){ adj[i].clear(); } et.clear(); et.pb(-1); for(i=0;i<bridges.size();i++){ adj[bridges[i].fi].push_back(bridges[i].se); adj[bridges[i].se].push_back(bridges[i].fi); } dfs(1, 0); ll lo = 1, hi = N, mid, best = 0; while(lo <= hi){ mid = (lo + hi) >> 1; vl t; for(i = 0; i<=mid; i++){ t.pb(et[i]); } if(query(t)){ best = et[mid]; hi = mid - 1; } else{ lo = mid + 1; } } return best; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 9996 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 10020 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 8 ms | 10052 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |