#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int mx=550;
vector<int> g[mx];
int a[mx],t;
void dfs(int u,int p) {
a[++t]=u;
for(int v:g[u]) {
if(v!=p) dfs(v,u);
}
}
int findEgg(int N,vector<pair<int,int>> bridges){
t=0;
for(int i=0;i<mx;++i) g[i].clear();
for(int i=0;i<N-1;++i) {
int u=bridges[i].first,v=bridges[i].second;
g[u].push_back(v);
g[v].push_back(u);
}
dfs(1,0);
int l=1,r=N;
while(l<=r) {
int mid=(l+r)/2;
vector<int> temp;
for(int i=1;i<=mid;++i) {
temp.push_back(a[i]);
}
if(query(temp)) {
r=mid-1;
} else {
l=mid+1;
}
}
return a[l];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
344 KB |
Number of queries: 5 |
2 |
Partially correct |
1 ms |
344 KB |
Number of queries: 5 |
3 |
Partially correct |
1 ms |
344 KB |
Number of queries: 5 |
4 |
Partially correct |
1 ms |
344 KB |
Number of queries: 5 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
728 KB |
Number of queries: 9 |
2 |
Correct |
8 ms |
744 KB |
Number of queries: 9 |
3 |
Correct |
11 ms |
992 KB |
Number of queries: 9 |
4 |
Correct |
10 ms |
996 KB |
Number of queries: 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
13 ms |
1248 KB |
Number of queries: 10 |
2 |
Correct |
11 ms |
1000 KB |
Number of queries: 9 |
3 |
Partially correct |
10 ms |
492 KB |
Number of queries: 10 |
4 |
Partially correct |
10 ms |
1000 KB |
Number of queries: 10 |