#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> ord;
vector < vector <int> > G(513);
void dfs(int nod, int t){
ord.push_back(nod);
for(auto x : G[nod]){
if(x == t) continue;
dfs(x, nod);
}
}
int findEgg(int N, vector < pair < int, int > > bridges){
for (int i = 1; i <= N; i++) G[i].clear();
ord.clear();
for(auto x : bridges){
G[x.first].push_back(x.second);
G[x.second].push_back(x.first);
}
dfs(1,0);
int st = 0, dr = N - 1,poz = 0;
while(st <= dr){
int med = (st + dr) >> 1;
if(query(vector <int> (ord.begin(), ord.begin() + med))){
poz = med;
dr = med - 1;
}
else st = med + 1;
}
return poz;
}
# |
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 |
1 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
496 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |