# include <bits/stdc++.h>
#include "grader.h"
#define f first
#define s second
#define pb push_back
using namespace std;
long long le,ri, mid;
vector <int> v2;
vector <long long> v1;
vector <long long> vvv[1005];
int ans;
void dfs(int a, int p) {
v1.pb(a);
for (int i=0; i<(int)vvv[a].size(); i++) {
if (vvv[a][i]!=p) {
dfs(vvv[a][i],a);
}
}
}
int findEgg(int n, vector <pair <int, int > > vv)
{
for (int i=0; i<(int)vv.size(); i++) {
vvv[vv[i].f].pb(vv[i].s);
vvv[vv[i].s].pb(vv[i].f);
}
dfs(1,0);
le=0;
ri=(int)v1.size()-1;
while (le<=ri) {
mid=(le+ri)/2;
v2.clear();
for (int i=0; i<=mid; i++) {
v2.pb(v1[i]);
}
if (query(v2)==1) {
ans=mid;
ri=mid-1;
}
else le=mid+1;
}
return v1[ans];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
206 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
206 ms |
131076 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |