#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define int ll
#include "grader.h"
vector<int> roads[515];
int nextnode=1, val[515];
void dfs(int x){
val[x] = nextnode;
nextnode++;
for(int i:roads[x]){
if(!val[i]){
dfs(i);
}
}
}
int findEgg (int n, vector<pair<int,int>> bridges){
for(pair<int,int> i:bridges){
roads[i.first].push_back(i.second);
roads[i.second].push_back(i.first);
}
dfs(1);
int low=1,high=n,mid;
while(low!=high){
mid = (low+high)/2;
vector<int> x;
for(int i=1;i<=mid;i++){
x.push_back(val[i]);
}
if(query(x)){
high = mid;
}
else{
low = mid+1;
}
}
nextnode = 1;
for(int i=1;i<=n;i++){
roads[i].clear();
val[i] = 0;
}
return low;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
464 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |