Submission #473790

# Submission time Handle Problem Language Result Execution time Memory
473790 2021-09-16T08:58:11 Z MamdouhN Odašiljači (COCI20_odasiljaci) C++17
42 / 70
14 ms 320 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

vector<pair<int,int>>points;

bool comp(pair<int,int> a,pair<int,int> b)
{
    int x = a.first+a.second;
    int y = b.first+b.second;
    if(x==y)
    {
        int aa = min(a.first,a.second);
        int bb = min(b.first,b.second);
        return aa<bb;
    }
    return x<y;
}

int pwr(double a,double b)
{
    int ret=1;
    while(b--)ret*=a;
    return ret;
}

main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a,b;
        cin>>a>>b;
        points.push_back({a,b});
    }
    double ans = -1;
    for(int i=0;i<n;i++)
    {
        double ret = 1e9;
        for(int j=0;j<n;j++)
        {
            if(i==j)continue;
            double x1 = points[i].first;
            double y1 = points[i].second;
            double x2 = points[j].first;
            double y2 = points[j].second;
            double dist = sqrt( pwr(x2-x1,2) + pwr(y2-y1,2) );
            dist/=2;
            ret =  min(dist,ret);
        }
        ans = max(ans,ret);
    }
    cout<<fixed<<setprecision(7)<<ans<<endl;
}

Compilation message

odasiljaci.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main()
      | ^~~~
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 4 ms 204 KB Output isn't correct
7 Correct 4 ms 204 KB Output is correct
8 Incorrect 7 ms 320 KB Output isn't correct
9 Incorrect 13 ms 204 KB Output isn't correct
10 Correct 14 ms 204 KB Output is correct