답안 #762828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762828 2023-06-21T20:19:58 Z ois Odašiljači (COCI20_odasiljaci) C++14
56 / 70
1000 ms 340 KB
#include <bits/stdc++.h>
using namespace std;
typedef pair <double, double> pii;
#define fi first
#define se second

pii cord[1005];
int vis[1005], n, qtd;
double mid;


double dist(pii a, pii b){ 
    return (a.fi - b.fi)*(a.fi - b.fi) + (a.se-b.se)*(a.se-b.se);
}

void dfs(int u){
  vis[u] = 1;
  qtd++;
  for(int i = 0; i<n; i++){
    if(vis[i] == 0 && dist(cord[i], cord[u]) < mid*mid) dfs(i);
  }
}

double buscab(){
    double l = 0, r = 2*1e9;
    while(l < r){
        mid = (l+r)/2.0;
        memset(vis, 0, sizeof(vis));
        qtd = 0;
        dfs(0);
        if(qtd == n) r = mid-1e-9;
        else l = mid+1e-9;
    }
    return r;
}

int main(){
    cin >> n;
    cout.precision(9);
    cout.setf(ios::fixed);
    for(int i = 0; i<n; i++) cin >> cord[i].fi >> cord[i].se;
    cout << (buscab())/2.0 << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Execution timed out 1087 ms 212 KB Time limit exceeded
6 Correct 14 ms 316 KB Output is correct
7 Correct 19 ms 332 KB Output is correct
8 Correct 43 ms 340 KB Output is correct
9 Correct 78 ms 340 KB Output is correct
10 Execution timed out 1090 ms 340 KB Time limit exceeded