Submission #623075

# Submission time Handle Problem Language Result Execution time Memory
623075 2022-08-05T07:05:15 Z 54skyxenon Mobile (BOI12_mobile) Python 3
Compilation error
0 ms 0 KB
// https://oj.uz/problem/view/BOI12_mobile

#include <bits/stdc++.h>
using namespace std;

#define EPS 0.001

int n, l;
vector<double> X, Y;

bool ok(double radius) {
    double range = 0.0;
    
    for (int i = 0; i < n; i++) {
        double term = (radius * radius) - (Y[i] * Y[i]);

        if (term >= 0) {
            double term_sqrt = sqrt(term);
            double range_l = X[i] - term_sqrt;
            double range_r = X[i] + term_sqrt;
            
            if (range_l <= range) {
                range = max(range, range_r);
            }
        }

        if (range >= l) {
            return false;
        }
    }
        
    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin >> n >> l;

    X.resize(n);
    Y.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> X[i] >> Y[i];
    }

    double lo = 0.0;
    double hi = 2e9;

    while (lo + EPS < hi) {
        double mid = (lo + hi) / 2;

        if (!ok(mid)) {
            hi = mid;
        }
        else {
            lo = mid;
        }
    }

    cout << lo << endl;
}

Compilation message

File "mobile.py", line 1
    // https://oj.uz/problem/view/BOI12_mobile
    ^
SyntaxError: invalid syntax