제출 #445893

#제출 시각아이디문제언어결과실행 시간메모리
445893JasiekstrzOdašiljači (COCI20_odasiljaci)C++17
70 / 70
61 ms8640 KiB
#include<bits/stdc++.h> #define fi first #define se second using namespace std; const int N=1e3; struct Point { long long x,y; }; long long d(Point a,Point b) { return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y); } int fau[N+10]; Point p[N+10]; vector<tuple<long long,int,int>> srt; int f(int x) { return (fau[x]==x ? fau[x]:fau[x]=f(fau[x])); } void u(int x,int y) { fau[f(y)]=f(x); return; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin>>n; for(int i=1;i<=n;i++) { fau[i]=i; cin>>p[i].x>>p[i].y; for(int j=1;j<i;j++) srt.emplace_back(d(p[j],p[i]),j,i); } sort(srt.begin(),srt.end()); long long mx=0; for(auto [c,a,b]:srt) { if(f(a)!=f(b)) { mx=c; u(a,b); } } cout<<fixed<<setprecision(7); cout<<sqrtl((long double)mx)/2<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...