#include <iostream>
#include <vector>
#include "grader.h"
using namespace std;
const int maxN = 512;
vector<int> edge[1+maxN];
vector<int> order;
vector<int> x_visit(1+maxN, 0);
void dfs(int u)
{
if(x_visit[u]) return;
order.push_back(u);
for(int v: edge[u]) dfs(v);
}
int b_search(int a, int b)
{
if(a == b) return order[a];
else
{
int m = (a+b)/2;
vector<int> Q;
for(int i = 0; i <= m; i++) Q.push_back(order[i]);
if(query(Q)) return b_search(a, m);
else return b_search(m+1, b);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for(int e = 0; e < N-1; e++)
{
edge[ bridges[e].first ].push_back( bridges[e].second );
edge[ bridges[e].second ].push_back( bridges[e].first );
}
dfs(1);
return b_search(0, N-1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
87 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
87 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
84 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |