# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
474140 | LeeRise | Odašiljači (COCI20_odasiljaci) | C++14 | 121 ms | 12728 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
# define auto_ac int main
using namespace std;
struct HA{
long long d,a,b;
};
struct point
{
long long x,y;
};
int n;
int root[100005];
vector<HA>v;
point p[10005];
long long abs(point a, point b)
{
return ((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
int find_root(int x)
{
if (root[x]==x) return x;
return root[x]=find_root(root[x]);
}
bool cmp(HA a, HA b)
{
return a.d<b.d;
}
auto_ac()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for (int i=1;i<=n;i++){
root[i]=i;
cin>>p[i].x>>p[i].y;
for (int j=1;j<i;j++){
v.push_back({abs(p[j],p[i]),j,i});
}
}
sort (v.begin(),v.end(),cmp);
long long ans;
for (int i=0;i<v.size();i++){
if (find_root(v[i].a)!=find_root(v[i].b)){
ans=v[i].d;
root[find_root(v[i].b)]=root[find_root(v[i].a)];
}
}
cout<<fixed<<setprecision(7)<<sqrt(ans)/2;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |