#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> g[600];
vector<int> w;
void dfs(int at, int p) {
w.push_back(at);
for (int to: g[at]) {
if (to == p) continue;
dfs(to, at);
}
}
int findEgg (int n, vector < pair < int, int > > edges) {
for (int i=0; i<=n; i++) {
g[i].clear();
}
for (auto ed: edges) {
int u = ed.first;
int v = ed.second;
g[u].push_back(v);
g[v].push_back(u);
}
w.clear();
dfs(1,0);
int lo = 1;
int hi = n;
while (hi-lo>1) {
int mid = (lo+hi)/2;
if (query(vector<int>(w.begin(), w.begin()+mid+1))) {
lo = mid;
} else {
hi = mid;
}
}
return w[lo-1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
492 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
620 KB |
Execution killed with signal 6 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |