Submission #473887

# Submission time Handle Problem Language Result Execution time Memory
473887 2021-09-16T11:18:03 Z AbdoMo Odašiljači (COCI20_odasiljaci) C++17
42 / 70
224 ms 312 KB
#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;
long double dis(long double x1,long double y1,long double x2,long double y2)
{
    return sqrt(abs(x1-x2)*abs(x1-x2)+abs(y1-y2)*abs(y1-y2));
}
bool valid(long 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});
    }
    long double ans=1e12,s=0,e=1e12,m;
    while((e-s)>=1e-9)
    {
        m=(s+e)/2.00000000;
       // cout<<m<<" "<<valid(m)<<endl;
        if(valid(m))
        {
            ans=m;
            e=m-1e-9;
        }
        else
        {
            s=m+1e-9;
        }
    }
    cout<<fixed<<setprecision(7)<<ans/2.00000000<<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
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 204 KB Output is correct
5 Correct 3 ms 312 KB Output is correct
6 Incorrect 59 ms 304 KB Output isn't correct
7 Correct 59 ms 300 KB Output is correct
8 Incorrect 131 ms 204 KB Output isn't correct
9 Incorrect 224 ms 304 KB Output isn't correct
10 Correct 220 ms 304 KB Output is correct