# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
334610 | GioChkhaidze | Odašiljači (COCI20_odasiljaci) | C++14 | 1084 ms | 4460 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 ll long long
#define pb push_back
using namespace std;
const int N=1e3+1;
int n,x[N],y[N],cnt;
bool f[N];
vector < int > v[N];
void Dfs(int x) {
++cnt;
f[x]=true;
for (int i=0; i<v[x].size(); i++) {
if (!f[v[x][i]]) Dfs(v[x][i]);
}
}
bool check(double d) {
cnt=0;
for (int i=1; i<=n; i++) {
v[i].clear();
f[i]=0;
}
for (int i=1; i<=n; i++)
for (int j=1; j<i; j++)
if (d*d>=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))
v[i].pb(j),v[j].pb(i);
Dfs(1);
return (cnt==n);
}
main () {
cin>>n;
for (int i=1; i<=n; i++) {
cin>>x[i]>>y[i];
}
double l=0,r=1e10,mid,res=-1;
for (int i=1; i<=1000; i++) {
mid=(l+r)/2.0;
if (check(mid))
res=mid,r=mid-0.0000001;
else
l=mid+0.0000001;
}
res/=2.0;
printf("%.7f",res);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |