Submission #1078125

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

using namespace std;

#define ll long long
#pragma gcc-optimize("o3, unrolls-loops")

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-7)
    {
        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';
}

Compilation message

odasiljaci.cpp:6: warning: ignoring '#pragma gcc ' [-Wunknown-pragmas]
    6 | #pragma gcc-optimize("o3, unrolls-loops")
      |
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 17 ms 484 KB Output is correct
7 Correct 17 ms 348 KB Output is correct
8 Correct 35 ms 348 KB Output is correct
9 Correct 56 ms 460 KB Output is correct
10 Correct 47 ms 344 KB Output is correct