#include <bits/stdc++.h>
#include "grader.h"
#define ll long long
#define pb push_back
#define epb emplace_back
#define inf 1e9+1
#define linf 1e18+1
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
using namespace std;
vector<vector<int> >g(513);
vector<int>vec;
int timer=0;
void dfs(int v,int e=-1){
vec.pb(v);
for(int to:g[v]){
if(to==e)continue;
dfs(to,v);
}
}
int findEgg (int N, vector < pair < int, int > > bridges){
for(int i=1;i<=N;i++)g[i].clear();
vec.clear();
for(pii x:bridges){
int u=x.f,v=x.s;
g[u].pb(v);
g[v].pb(u);
}
dfs(1);
int l=0,r=N;
while(l+1<r){
int mid=(l+r)/2;
vector<int>q;
for(int i=0;i<mid;i++)q.pb(vec[i]);
if(query(q))r=mid;
else l=mid;
}
return vec[r-1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Number of queries: 4 |
2 |
Correct |
2 ms |
200 KB |
Number of queries: 4 |
3 |
Correct |
1 ms |
200 KB |
Number of queries: 4 |
4 |
Correct |
1 ms |
200 KB |
Number of queries: 4 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
332 KB |
Number of queries: 8 |
2 |
Correct |
9 ms |
360 KB |
Number of queries: 9 |
3 |
Correct |
21 ms |
344 KB |
Number of queries: 9 |
4 |
Correct |
14 ms |
328 KB |
Number of queries: 9 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
328 KB |
Number of queries: 9 |
2 |
Correct |
13 ms |
328 KB |
Number of queries: 9 |
3 |
Correct |
18 ms |
348 KB |
Number of queries: 9 |
4 |
Correct |
12 ms |
344 KB |
Number of queries: 9 |