#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector<int> g[550];
int p[550],nrr;
void dfs(int nod=1, int t=0)
{
p[++nrr]=nod;
for(auto i:g[nod])if(i!=t)dfs(i,nod);
}
bool qq(int poz)
{
vector<int> qqq;
for(int i=1;i<=poz;i++)qqq.push_back(p[i]);
return query(qqq);
}
int findEgg(int N, vector<pair<int,int> > bridges)
{
int st=1,dr=N-1,m,poz=N;
for(auto i:bridges)
{
g[i.first].push_back(i.second);
g[i.second].push_back(i.first);
}
dfs();
while(st<=dr)
{
m=st+(dr-st)/2;
if(qq(m))
{
poz=m;
dr=m-1;
}
else st=m+1;
}
return p[poz];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
328 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
456 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |