/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Accepted 1ms 468.0 KiB
#4 Wrong Answer 2ms 324.0 KiB
#5 Accepted 2ms 532.0 KiB
#6 Accepted 2ms 324.0 KiB
#7 Accepted 2ms 536.0 KiB
#8 Accepted 2ms 320.0 KiB
#9 Accepted 2ms 324.0 KiB
#10 Accepted 2ms 324.0 KiB
#11 Wrong Answer 2ms 320.0 KiB

Code

/*
 *   Copyright (c) 2024 Emon Thakur
 *   All rights reserved.
 */
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
using minheap = priority_queue<long long, vector<long long>, greater<long long>>;
typedef tree<int, null_type, greater_equal<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

#define ll long long
#define ld long double
#define MOD 1000000007
#define pie 2*(acos(0.0))
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define pb push_back
#define endl '\n'
#define lcm(a,b) (a*b)/(__gcd<ll>(a,b))
#define print(v) for(auto e:v) cout<<e<<" "; cout<<endl;
#define printp(v) for(auto e:v) cout<<e.first<<" "<<e.second<<endl;
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(),v.rend())
#define life_is_a_race ios::sync_with_stdio(false); cin.tie(nullptr);
const ld eps = 1e-6;
void solve(int tc)
{
    //cout<<"Case "<<tc<<": ";
    int n; cin >> n;
    vector<pair<ld,ld>> v(n);
    for(int i=0;i<n;i++)
    {
        cin>>v[i].first >> v[i].second;
    }
    ld ans  = 0;
    auto chk = [&](ld mid) -> bool
    {
        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                ld r,x,y,d;
                x = (v[i].first + v[j].first) / 2.0L;
                y = (v[i].second + v[j].second) / 2.0L;
                r = sqrtl((v[i].first - v[j].first) * (v[i].first - v[j].first) + (v[i].second - v[j].second) * (v[i].second - v[j].second));
                if(r > mid){
                    return false;
                }
            }
        }

        return true;
    };

    ld l = 0.0L, r = 1000000000.0L;
    int c = 100;
    while(c--){
        ld mid = (l + r) / 2.0L;

        if(chk(mid)){
            r = mid;
            ans = mid;
        }
        else{
            l = mid;
        }
    }

    ans = ans / 2.0L;

    cout << fixed << setprecision(18) << ans;
}
int main()
{
    life_is_a_race
    int t=1; 
    //cin>>t;
    for(int i=1;i<=t;i++) solve(i);
}

Information

Submit By
Type
Submission
Problem
P1123 Relic Rescue Radius!
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 12:13:37
Judged At
2024-11-11 02:34:41
Judged By
Score
45
Total Time
2ms
Peak Memory
536.0 KiB