#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int maxn=520;
vector<int> adj[maxn];
vector<int> v;
int ptr;
vector<int> q;
void dfs(int x, int p){
v.emplace_back(x);
for (auto u:adj[x]){
if (u==p) continue;
dfs(u,x);
}
}
int findEgg (int N, vector < pair < int, int > > bridges)
{
for (auto [u,v]:bridges){
adj[u].emplace_back(v);
adj[v].emplace_back(u);
}
dfs(1,-1);
int l=0,r=N,m;
while (l!=r-1){
m=(l+r)>>1;
while (ptr<m){
q.emplace_back(v[ptr++]);
}
while (ptr>m){
q.pop_back();
ptr--;
}
if (query(q)) r=m;
else l=m;
}
return v[l];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
225 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
173 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
161 ms |
131072 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |