#include<bits/stdc++.h>
#include "grader.h"
using namespace std;
#define fi first
#define se second
#define pb push_back
vector<int> g[10000], q;
void dfs(int u, int f = -1) {
q.pb(u);
for(int i: g[u])
if(i != f)
dfs(i, u);
}
int bin_search(int l, int r) {
int m;
while(l < r) {
m = (l + r) >> 1;
if(query(vector<int>(q.begin(), q.begin() + m)))
r = m;
else
l = m + 1;
}
return l;
}
int findEgg(int N, vector< pair<int, int> > bridges) {
for(auto i: bridges) {
g[i.fi].pb(i.se);
g[i.se].pb(i.fi);
}
dfs(1);
return q[bin_search(1, N) - 1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
297 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
252 ms |
131072 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
265 ms |
131076 KB |
Execution killed with signal 9 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |