Submission #872103

#TimeUsernameProblemLanguageResultExecution timeMemory
872103SalihSahinOdašiljači (COCI20_odasiljaci)C++17
70 / 70
94 ms480 KiB
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define int long long using namespace std; const int N = 1e3 + 5; const int mod = 1e9+7; int par[N]; int find(int a){ if(a == par[a]) return a; return par[a] = find(par[a]); } bool merge(int a, int b){ a = find(a); b = find(b); if(a == b) return 0; par[b] = a; return 1; } int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n; cin>>n; vector<pair<double, double> > a(n); for(int i = 0; i < n; i++){ cin>>a[i].first>>a[i].second; } double diff = 1e-7; double l = 0, r = 1e10; while(l + diff < r){ double mid = (l + r)/2; int g = n; for(int i = 0; i < n; i++) par[i] = i; for(int i = 0; i < n; i++){ for(int j = i+1; j < n; j++){ double dis = sqrt((a[i].first - a[j].first)*(a[i].first - a[j].first) + (a[i].second - a[j].second)*(a[i].second - a[j].second)); if(mid * 2 >= dis){ g -= merge(i, j); } } } if(g == 1){ r = mid; } else l = mid; } printf("%.7f \n", l); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...