#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int>g[513];
vector<int>a;
void dfs(int node,int par)
{
a.push_back(node);
for(auto ax:g[node])
{
if(ax==par)continue;
dfs(ax,node);
}
}
int findEgg (int n, vector < pair < int, int > > b)
{
for (int i = 1; i <= n; i++) g[i].clear();
a.clear();
for(auto ax:b)
{
g[ax.first].push_back(ax.second);
g[ax.second].push_back(ax.first);
}
dfs(1,-1);
int l=1;
int r=n;
while(l<r)
{
int mid=l+(r-l)/2;
vector<int>v;
for(int i=l;i<mid;i++)
{
v.push_back(a[i]);
}
if(query(v)==1)
{
r=mid;
}
else
{
l=mid+1;
}
}
return a[l-1];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
444 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
472 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
500 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |