#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define si second
#define ar array
typedef pair<int,int> pi;
#include "grader.h"
vector<int> adj[520], order;
void dfs(int x, int p) {
order.pb(x);
for (auto i: adj[x]) {
if (i == p) continue;
dfs(i, x);
}
}
int findEgg (int n, vector < pair < int, int > > bridges)
{
order.clear();
for (int i = 1; i <= n; ++i) adj[i].clear();
for (auto i: bridges) {
adj[i.fi].pb(i.si);
adj[i.si].pb(i.fi);
}
dfs(1, -1);
int lo = 0, hi = n + 1;
while (lo + 1 < hi) {
int mid = (lo + hi) / 2;
vector<int> lq;
for (int i = lo + 1; i <= mid; ++i) lq.pb(order[i - 1]);
if (query(lq)) hi = mid;
else lo = mid;
}
return order[hi - 1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
200 KB |
Number of queries: 5 |
2 |
Runtime error |
1 ms |
432 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |