#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
const int MXN = 512;
vector<int> adj[MXN], ord;
void dfs(int node = 0, int par = -1){
ord.push_back(node+1);
for(int v : adj[node]){
if(v == par)
continue;
dfs(v, node);
}
}
int findEgg(int N, vector<pair<int, int>> edges){
for(auto& i : adj) i.clear();
ord.clear();
for(auto& [u, v] : edges){
--u, --v;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs();
int lo = 0, hi = N-1;
while(lo < hi){
int mid = (lo + hi + 1) >> 1;
if(query(vector<int>(ord.begin(), ord.begin() + mid)))
hi = mid - 1;
else lo = mid;
}
return ord[lo];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Number of queries: 4 |
2 |
Correct |
2 ms |
364 KB |
Number of queries: 4 |
3 |
Correct |
2 ms |
364 KB |
Number of queries: 4 |
4 |
Correct |
2 ms |
364 KB |
Number of queries: 4 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
364 KB |
Number of queries: 8 |
2 |
Correct |
13 ms |
364 KB |
Number of queries: 9 |
3 |
Correct |
20 ms |
364 KB |
Number of queries: 9 |
4 |
Correct |
18 ms |
364 KB |
Number of queries: 9 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
384 KB |
Number of queries: 9 |
2 |
Correct |
18 ms |
364 KB |
Number of queries: 9 |
3 |
Correct |
21 ms |
364 KB |
Number of queries: 9 |
4 |
Correct |
18 ms |
364 KB |
Number of queries: 9 |