# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
473883 | AbdoMo | Odašiljači (COCI20_odasiljaci) | C++17 | 1094 ms | 364 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 int long long
#define ll long long
#define pb push_back
const int mod = 1e9+7;
using namespace std;
bool comp(string a,string b)
{
if(a.size()==b.size())
{
return a<b;
}
return a.size()<b.size();
}
int n;
vector<pair<int,int>>v;
double dis(double x1,double y1,double x2,double y2)
{
return sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
}
bool valid(double rad)
{
bool vis[n]={};
for(int i=0;i<n;i++)
{
for(int j=i+1;j<n;j++)
{
if(dis(v[i].first,v[i].second,v[j].first,v[j].second)<=rad)
{
vis[i]=1;
vis[j]=1;
}
}
}
bool val=1;
for(int i=0;i<n;i++)
{
val&=vis[i];
}
return val;
}
void solve(){
cin>>n;
for(int i=0;i<n;i++)
{
int x,y;
cin>>x>>y;
v.pb({x,y});
}
double ans=1e12,s=0,e=1e12,m;
while((e-s)>=1e-9)
{
m=(s+e)/2.0;
// cout<<m<<" "<<valid(m)<<endl;
if(valid(m))
{
ans=m;
e=m-1e-9;
}
else
{
s=m+1e-9;
}
}
cout<<fixed<<setprecision(8)<<ans/2.0<<endl;
}
int32_t main(){
int t=1;
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
// cin>>t;
while(t--){solve();}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |