#include "grader.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> o;
vector<vector<int>> g(520);
void order(int x, int t) {
o.push_back(x);
for (int i : g[x]) {
if (i == t)
continue;
order(i, x);
}
}
int findEgg(int N, vector < pair < int, int > > bridges) {
for (auto p : bridges) {
int u = p.first, v = p.second;
g[u].push_back(v);
g[v].push_back(u);
}
order(1, -1);
int l = 0, r = N-2, mid, x = N-1;
while (l <= r) {
mid = (l+r)/2;
vector<int> a;
for (int i=0; i<=mid; i++)
a.push_back(o[i]);
if (query(a)) {
r = mid-1;
x = mid;
} else {
l = mid+1;
}
}
int ans = o[x];
o.clear();
for (auto v : g)
v.clear();
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
1516 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
200 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
204 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |