Submission #1078121

# Submission time Handle Problem Language Result Execution time Memory
1078121 2024-08-27T12:59:58 Z 12345678 Odašiljači (COCI20_odasiljaci) C++17
0 / 70
1000 ms 600 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]))<=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;
    }
    printf("%.8llf", l);
}

Compilation message

odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:37:18: warning: use of 'll' length modifier with 'f' type character has either no effect or undefined behavior [-Wformat=]
   37 |     printf("%.8llf", l);
      |                  ^
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Expected double, but "nan" found
2 Incorrect 0 ms 348 KB Expected double, but "nan" found
3 Incorrect 0 ms 348 KB Expected double, but "nan" found
4 Incorrect 1 ms 348 KB Expected double, but "nan" found
5 Execution timed out 1068 ms 348 KB Time limit exceeded
6 Incorrect 18 ms 348 KB Expected double, but "nan" found
7 Incorrect 17 ms 344 KB Expected double, but "nan" found
8 Incorrect 37 ms 348 KB Expected double, but "nan" found
9 Incorrect 62 ms 348 KB Expected double, but "nan" found
10 Incorrect 51 ms 600 KB Expected double, but "nan" found