Submission #473889

# Submission time Handle Problem Language Result Execution time Memory
473889 2021-09-16T11:20:59 Z AbdoMo Odašiljači (COCI20_odasiljaci) C++17
42 / 70
394 ms 452 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<long double,long double>>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});
    }
    double x=2;
    long double ans=1e9,s=0,e=1e9,m;
    while((e-s)>=1e-10)
    {
        m=(s+e)/x;
       // cout<<m<<" "<<valid(m)<<endl;
        if(valid(m))
        {
            ans=m;
            e=m-1e-10;
        }
        else
        {
            s=m+1e-10;
        }
    }

    cout<<fixed<<setprecision(9)<<ans/x<<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 1 ms 204 KB Output isn't correct
3 Correct 2 ms 204 KB Output is correct
4 Correct 3 ms 268 KB Output is correct
5 Correct 5 ms 204 KB Output is correct
6 Incorrect 99 ms 332 KB Output isn't correct
7 Correct 101 ms 332 KB Output is correct
8 Incorrect 230 ms 452 KB Output isn't correct
9 Incorrect 394 ms 356 KB Output isn't correct
10 Correct 386 ms 360 KB Output is correct