#include "grader.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
int findEgg(int n, vector<pair<int, int>> bridges){
vector<vector<int>> v(n);
for(auto [a, b]: bridges) a--, b--, v[a].pb(b), v[b].pb(a);
vector<int> dfs_array;
function<void(int, int)> dfs = [&](int nd, int ss){
dfs_array.pb(nd+1);
for(int x: v[nd]) if(x != ss) dfs(x, nd);
};
dfs(0, -1);
int a = 0, b = n-1;
while(a < b){
int md = (a+b)/2;
if(query(vector<int>(dfs_array.begin(), dfs_array.begin()+md+1))) b = md;
else a = md+1;
}
return dfs_array[a];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
208 KB |
Number of queries: 4 |
2 |
Correct |
2 ms |
208 KB |
Number of queries: 4 |
3 |
Correct |
1 ms |
208 KB |
Number of queries: 4 |
4 |
Correct |
1 ms |
208 KB |
Number of queries: 4 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
336 KB |
Number of queries: 8 |
2 |
Correct |
13 ms |
336 KB |
Number of queries: 9 |
3 |
Correct |
19 ms |
348 KB |
Number of queries: 9 |
4 |
Correct |
22 ms |
344 KB |
Number of queries: 9 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
388 KB |
Number of queries: 9 |
2 |
Correct |
23 ms |
352 KB |
Number of queries: 9 |
3 |
Correct |
26 ms |
348 KB |
Number of queries: 9 |
4 |
Correct |
25 ms |
336 KB |
Number of queries: 9 |