#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> g[513];
int t[512], dfsTimer;
void dfs(int u, int p){
t[dfsTimer++] = u;
for(int v : g[u]) if(v != p) dfs(v, u);
}
int findEgg (int n, vector <pair<int, int>> e){
for(int i=0; i<n; ++i) g[i+1].clear();
dfsTimer = 0;
for(auto &[u, v] : e){
g[u].push_back(v);
g[v].push_back(u);
}
dfs(1, 1);
int x = 0;
for(int y=n > 16 ? 512 : 16; y/=2; ){
if(x + y <= n){
vector<int> q(x+y);
for(int j=0; j<x+y; ++j) q[j] = t[j];
x += y * !query(q);
}
}
return t[x];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
200 KB |
Number of queries: 4 |
2 |
Correct |
1 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
328 KB |
Number of queries: 9 |
2 |
Correct |
13 ms |
328 KB |
Number of queries: 9 |
3 |
Correct |
25 ms |
328 KB |
Number of queries: 9 |
4 |
Correct |
19 ms |
328 KB |
Number of queries: 9 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
360 KB |
Number of queries: 9 |
2 |
Correct |
20 ms |
356 KB |
Number of queries: 9 |
3 |
Correct |
21 ms |
336 KB |
Number of queries: 9 |
4 |
Correct |
19 ms |
328 KB |
Number of queries: 9 |