/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 2ms 332.0 KiB
#3 Accepted 1ms 540.0 KiB
#4 Wrong Answer 2ms 492.0 KiB
#5 Wrong Answer 1ms 332.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define nl '\n'
const int N = 1e5+5;

double a[N], b[N];

double dis(double x, double y, double xx, double yy){
    return ((x-xx)*(x-xx)+(y-yy)*(y-yy));
}

int main() {
    int n; cin >> n;
    double mxx = -2e9, mxy = -2e9;
    double mnx = 2e9, mny = 2e9;
    for(int i=0;i<n;++i) cin >> a[i] >> b[i];
    for(int i=0;i<n;++i) mxx = max(mxx, a[i]), mnx = min(mnx, a[i]);
    for(int i=0;i<n;++i) mxy = max(mxy, b[i]), mny = min(mny, b[i]);
    double mx = (mxx + mnx) / 2.0;
    double my = (mxy + mny) / 2.0;
    // cerr << mx << endl;
    // cerr << my << endl;

    double l = 0;
    double r = 1e6;
    int t = 100;
    while(t--){
        double mid = (l+r)/2.0;
        bool ok = true;
        for(int i=0;i<n;++i) ok &= (dis(a[i], b[i], mx, my) <= mid*mid);
        if(ok) r = mid;
        else l = mid;
    }
    cout << fixed << setprecision(10) << l << nl;

}

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 09:49:13
Judged At
2024-10-30 09:49:13
Judged By
Score
15
Total Time
2ms
Peak Memory
540.0 KiB