#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
using idata = vector<int>;
using graph = vector<idata>;
using ipair = pair<int, int>;
using ipdata = vector<ipair>;
graph roads;
idata tour;
void dfs (int node, int parent) {
tour.push_back(node);
for (int next : roads[node]) if (next != parent)
dfs(next, node);
}
int query (int size) {
idata query_tour(size);
for (int i = 0; i < size; i ++)
query_tour[i] = tour[i];
return query(query_tour);
}
int result () {
int a = 0;
int b = tour.size();
while (b - a > 1) {
int c = (a + b) >> 1;
if (query(c)) a = c;
else b = c;
}
return tour[a - 1];
}
int findEgg (int N, ipdata bridges)
{
roads.resize(N + 1);
for (ipair bridge : bridges) {
roads[bridge.first ].push_back(bridge.second);
roads[bridge.second].push_back(bridge.first );
}
return result();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
336 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |