#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(0, -1);
int ans = 0;
int lo = 0; int hi = N-1;
while(hi >= lo){
int mid = lo + (hi - lo);
vector<int> ask(mid);
for(int i = 0; i < mid; ++i) ask[i] = order[i];
if(query(ask)){
hi = mid-1;
}
else{
ans = mid;
lo = mid+1;
}
}
return ans+1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |