#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int n,cnt,ans;
vector<int>v[550];
void dfs(int s,int p){
cnt++;
if(ans)return;
if(cnt==n&&!ans){
ans=s;
return;
}
vector<int>t;
t.push_back(s);
if(query(t)){
ans=s;
return;
}
for(auto e:v[s])if(e!=p)dfs(e,s);
}
int findEgg(int N,vector<pair<int,int> >b){
n=N;
for(int i=0;i<n;i++)v[i].clear();
for(auto e:b){
v[e.first].push_back(e.second);
v[e.second].push_back(e.first);
}
ans=0;
cnt=0;
dfs(1,0);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
548 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
576 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |