#include <vector>
#include "grader.h"
using namespace std;
using vi = vector<int>;
using pii = pair<int, int>;
const int p_mx = 512;
vi p_edge[1+p_mx];
vi p_ord(1, 0);
void dfs(int u, int p)
{
p_ord.push_back(u);
for(int v : p_edge[u])
{
if(v != p)
dfs(v, u);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for(pii b: bridges)
{
p_edge[b.first].push_back(b.second);
p_edge[b.second].push_back(b.first);
}
dfs(1, 0);
int lo = 1, hi = N;
while(lo != hi)
{
int mid = (lo+hi)/2;
vi qr;
for(int i = 1; i <= mid; i++)
qr.push_back(p_ord[i]);
if(query(qr))
hi = mid;
else
lo = mid+1;
}
return p_ord[lo];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
334 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
208 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
203 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |