# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
660262 | 2022-11-21T11:09:16 Z | a_aguilo | Easter Eggs (info1cup17_eastereggs) | C++14 | 23 ms | 508 KB |
#include <bits/stdc++.h> #include "grader.h" using namespace std; vector<int> order; vector<vector<int>> listaAdy; void dfs(int nodo, int padre){ order.push_back(nodo); for(int vecino: listaAdy[nodo]){ if(vecino == padre) continue; dfs(vecino, nodo); } } int findEgg (int N, vector < pair < int, int > > bridges) { listaAdy = vector<vector<int>>(N+1); order = vector<int>(); for(pair<int, int> bridge: bridges){ listaAdy[bridge.second].push_back(bridge.first); listaAdy[bridge.first].push_back(bridge.second); } dfs(1, -1); int ans = 0; int lo = 0; int hi = N-1; vector<int> ask((N)/2); for(int i = 0; i < (N)/2; ++i) ask[i] = order[i]; while(hi >= lo){ int mid = lo + (hi - lo)/2; while(ask.size() < mid){ ask.push_back(order[ask.size()]); } while(ask.size() > mid) ask.pop_back(); if(query(ask)){ hi = mid-1; } else{ ans = mid; lo = mid+1; } } return order[ans]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 464 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 324 KB | Number of queries: 9 |
2 | Correct | 13 ms | 356 KB | Number of queries: 9 |
3 | Correct | 23 ms | 356 KB | Number of queries: 9 |
4 | Runtime error | 7 ms | 508 KB | Execution killed with signal 6 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 18 ms | 368 KB | Number of queries: 10 |
2 | Correct | 16 ms | 336 KB | Number of queries: 9 |
3 | Runtime error | 8 ms | 496 KB | Execution killed with signal 6 |
4 | Halted | 0 ms | 0 KB | - |