Submission #445479

#TimeUsernameProblemLanguageResultExecution timeMemory
445479grtOdašiljači (COCI20_odasiljaci)C++17
70 / 70
64 ms8640 KiB
#include <bits/stdc++.h> #define ST first #define ND second #define PB push_back using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; struct P { int x, y; }; const int nax = 1000 + 10; int n; P p[nax]; vector<tuple<ll,int,int>>d; int par[nax], siz[nax]; int Fund(int x) { if(par[x] != x) par[x] = Fund(par[x]); return par[x]; } ll ans; void Onion(int a, int b, ll c) { a = Fund(a); b = Fund(b); if(a == b) return; ans = c; if(siz[a] < siz[b]) swap(a, b); siz[a] += siz[b]; par[b] = a; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 0; i < n; ++i) { cin >> p[i].x >> p[i].y; par[i] = i; siz[i] =1; } for(int i = 0; i < n; ++i) { for(int j = i + 1; j < n; ++j) { d.PB({(ll)(p[i].x - p[j].x) * (p[i].x - p[j].x) + (ll)(p[i].y - p[j].y) * (p[i].y - p[j].y), i, j}); } } sort(d.begin(), d.end()); for(auto [c, u, v] : d) { Onion(u,v,c); } long double res = sqrtl(ans) / 2.0; cout << setprecision(10); cout << fixed; cout << res; }
#Verdict Execution timeMemoryGrader output
Fetching results...