#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int>v[513];
vector<int>order;
void dfs (int x, int par)
{
order.push_back(x);
for (int i : v[x])
{
if (i == par)
continue;
dfs(i, x);
}
}
int findEgg(int N, vector < pair < int, int > > bridges)
{
for (pair<int, int>p : bridges)
{
v[p.first].push_back(p.second);
v[p.second].push_back(p.first);
}
dfs(1, -1);
int l=1, r=N;
while (l < r)
{
int mid = (l + r) / 2;
vector<int>curr;
for (int i=0; i<mid; i++)
curr.push_back(order[i]);
if (query(curr))
r = mid;
else
l = mid + 1;
}
return order[r-1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
239 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
189 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
186 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |