#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=512; 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 |
Partially correct |
1 ms |
200 KB |
Number of queries: 5 |
2 |
Partially correct |
1 ms |
200 KB |
Number of queries: 5 |
3 |
Partially correct |
2 ms |
200 KB |
Number of queries: 5 |
4 |
Partially correct |
1 ms |
200 KB |
Number of queries: 5 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
456 KB |
Number of queries: 9 |
2 |
Correct |
14 ms |
340 KB |
Number of queries: 9 |
3 |
Correct |
26 ms |
344 KB |
Number of queries: 9 |
4 |
Correct |
19 ms |
360 KB |
Number of queries: 9 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
328 KB |
Number of queries: 9 |
2 |
Correct |
14 ms |
352 KB |
Number of queries: 9 |
3 |
Correct |
19 ms |
356 KB |
Number of queries: 9 |
4 |
Correct |
23 ms |
356 KB |
Number of queries: 9 |