답안 #473879

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473879 2021-09-16T11:12:35 Z AbdoMo Odašiljači (COCI20_odasiljaci) C++17
28 / 70
1000 ms 316 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;
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(s<=e)
    {
        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(9)<<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;
}
# 결과 실행 시간 메모리 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 Execution timed out 1099 ms 204 KB Time limit exceeded
6 Incorrect 57 ms 316 KB Output isn't correct
7 Correct 58 ms 204 KB Output is correct
8 Incorrect 115 ms 204 KB Output isn't correct
9 Incorrect 199 ms 312 KB Output isn't correct
10 Execution timed out 1080 ms 204 KB Time limit exceeded