# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
660267 | 2022-11-21T11:33:44 Z | a_aguilo | Easter Eggs (info1cup17_eastereggs) | C++14 | 23 ms | 632 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); 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 = 1; int hi = N; vector<int> ask((N)/2); for(int i = 0; i < (N)/2; ++i) ask[i] = order[i]; while(hi >= lo){ int mid = (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; ans = mid; } else{ lo = mid+1; } } return order[ans-1]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 292 KB | Number of queries: 5 |
2 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
3 | Partially correct | 1 ms | 208 KB | Number of queries: 5 |
4 | Partially correct | 2 ms | 208 KB | Number of queries: 5 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 336 KB | Number of queries: 9 |
2 | Correct | 15 ms | 632 KB | Number of queries: 9 |
3 | Correct | 16 ms | 448 KB | Number of queries: 9 |
4 | Correct | 15 ms | 548 KB | Number of queries: 9 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 18 ms | 464 KB | Number of queries: 10 |
2 | Correct | 19 ms | 616 KB | Number of queries: 9 |
3 | Partially correct | 15 ms | 456 KB | Number of queries: 10 |
4 | Partially correct | 23 ms | 540 KB | Number of queries: 10 |