#include <bits/stdc++.h>
#include "grader.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#define pb push_back
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define pii pair<int, int>
using namespace std;
const int NN = 513;
vector<int> edges[NN];
vector<int> vv;
int nn;
void dfs(int u, int p = -1){
vv.pb(u);
for(auto x:edges[u]){
if(x == p) continue;
dfs(x, u);
}
}
int findEgg (int N, vector < pair < int, int > > bb){
for(int i=0;i<NN;i++) edges[i].clear();
for(auto x:bb){
edges[x.ff].pb(x.ss);
edges[x.ss].pb(x.ff);
}
vv.clear();
dfs(1);
int l = 0, r = sz(vv)-1;
while(l < r){
int m = (l + r)>>1;
vector<int> tt;
for(int i=l;i<=m;i++) tt.pb(vv[i]);
if(query(tt)) r = m;
else l = m+1;
}
return vv[l];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
364 KB |
Number of queries: 4 |
2 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
492 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
620 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |