Submission #1318030

#TimeUsernameProblemLanguageResultExecution timeMemory
1318030bshaliOdašiljači (COCI20_odasiljaci)C++20
0 / 70
2 ms332 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define all(x) x.begin(), x.end()
#define inf (int)3e18
#define ff first
#define ss second
using vi = vector<int>;
using vii = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using pii = pair<int, int>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

const int MAX = 3e5 + 5;

void solve()
{
    int n;
    cin >> n;

    vii a;

    for (int i = 1; i <= n; i++)
    {
        int u, v;
        cin >> u >> v;

        a.push_back({u, v});
    }

    long double dist = 1000000000.0;

    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            long double x = (long double)(a[j].ff + a[i].ff) / 2;
            long double y = (long double)(a[j].ss + a[i].ss) / 2;

            long double r = (x - a[i].ff) * (x - a[i].ff) + (y - a[i].ss) * (y - a[i].ss);

            r = sqrtl(r);

            dist = min(dist, r);
        }
    }

    cout << fixed << setprecision(7) << dist;
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int tt = 1;
    // cin >> tt;
    while (tt--)
        solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...