Submission #1078124

# Submission time Handle Problem Language Result Execution time Memory
1078124 2024-08-27T13:02:24 Z 12345678 Odašiljači (COCI20_odasiljaci) C++17
63 / 70
1000 ms 460 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=1e3+5;

ll n, x[nx], y[nx], dsu[nx];
double l=0, r=2e9;

int find(int x)
{
    if (dsu[x]==x) return x;
    return dsu[x]=find(dsu[x]);
}


int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n ;i++) cin>>x[i]>>y[i];
    while (r-l>1e-8)
    {
        double md=(l+r)/2;
        for (int i=1; i<=n; i++) dsu[i]=i;
        for (int i=1; i<=n; i++)
        {
            for (int j=i+1; j<=n; j++) if ((double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=4*md*md) dsu[find(i)]=find(j);
        }
        int f=0;
        for (int i=1; i<=n; i++) if (find(i)!=find(1)) f=1;
        if (f) l=md;
        else r=md;
    }
    cout<<setprecision(8)<<l<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Execution timed out 1098 ms 348 KB Time limit exceeded
6 Correct 18 ms 348 KB Output is correct
7 Correct 18 ms 348 KB Output is correct
8 Correct 37 ms 348 KB Output is correct
9 Correct 74 ms 460 KB Output is correct
10 Correct 60 ms 348 KB Output is correct