Submission #623090

# Submission time Handle Problem Language Result Execution time Memory
623090 2022-08-05T07:17:26 Z 54skyxenon Mobile (BOI12_mobile) C++17
100 / 100
605 ms 16024 KB
// https://oj.uz/problem/view/BOI12_mobile

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

#define EPS 0.001
#define maxN 1000000

int n, l;
double X[maxN];
double Y[maxN];

bool ok(double radius) {
    double range = 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<double>(range, range_r);
            }
        }

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

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

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

    double lo = 0, hi = l;

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

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

    cout << fixed << setprecision(4) << lo << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 416 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 400 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1488 KB Output is correct
2 Correct 40 ms 1408 KB Output is correct
3 Correct 24 ms 1072 KB Output is correct
4 Correct 43 ms 1460 KB Output is correct
5 Correct 22 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1632 KB Output is correct
2 Correct 34 ms 1408 KB Output is correct
3 Correct 38 ms 1528 KB Output is correct
4 Correct 43 ms 1472 KB Output is correct
5 Correct 49 ms 1584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 40 ms 1612 KB Output is correct
2 Correct 44 ms 1556 KB Output is correct
3 Correct 43 ms 1564 KB Output is correct
4 Correct 72 ms 1876 KB Output is correct
5 Correct 38 ms 1676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 1868 KB Output is correct
2 Correct 53 ms 1880 KB Output is correct
3 Correct 42 ms 1868 KB Output is correct
4 Correct 68 ms 1868 KB Output is correct
5 Correct 51 ms 1884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1784 KB Output is correct
2 Correct 53 ms 1856 KB Output is correct
3 Correct 45 ms 1868 KB Output is correct
4 Correct 59 ms 1840 KB Output is correct
5 Correct 53 ms 1912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 235 ms 8120 KB Output is correct
2 Correct 272 ms 8148 KB Output is correct
3 Correct 255 ms 8212 KB Output is correct
4 Correct 302 ms 8144 KB Output is correct
5 Correct 256 ms 8112 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 293 ms 8028 KB Output is correct
2 Correct 318 ms 8088 KB Output is correct
3 Correct 227 ms 8268 KB Output is correct
4 Correct 283 ms 8132 KB Output is correct
5 Correct 259 ms 8048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 299 ms 9768 KB Output is correct
2 Correct 342 ms 9716 KB Output is correct
3 Correct 335 ms 9732 KB Output is correct
4 Correct 351 ms 9604 KB Output is correct
5 Correct 287 ms 9796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 353 ms 9592 KB Output is correct
2 Correct 368 ms 9804 KB Output is correct
3 Correct 264 ms 9636 KB Output is correct
4 Correct 390 ms 9692 KB Output is correct
5 Correct 297 ms 9756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 345 ms 11276 KB Output is correct
2 Correct 374 ms 11180 KB Output is correct
3 Correct 362 ms 11236 KB Output is correct
4 Correct 431 ms 11276 KB Output is correct
5 Correct 326 ms 11224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 399 ms 11240 KB Output is correct
2 Correct 412 ms 11272 KB Output is correct
3 Correct 347 ms 11212 KB Output is correct
4 Correct 405 ms 11204 KB Output is correct
5 Correct 379 ms 11156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 389 ms 12872 KB Output is correct
2 Correct 442 ms 12836 KB Output is correct
3 Correct 414 ms 12912 KB Output is correct
4 Correct 491 ms 12836 KB Output is correct
5 Correct 403 ms 12752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 490 ms 12772 KB Output is correct
2 Correct 493 ms 12840 KB Output is correct
3 Correct 362 ms 12792 KB Output is correct
4 Correct 476 ms 12840 KB Output is correct
5 Correct 397 ms 12756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 497 ms 15928 KB Output is correct
2 Correct 569 ms 15944 KB Output is correct
3 Correct 535 ms 15964 KB Output is correct
4 Correct 602 ms 15956 KB Output is correct
5 Correct 518 ms 16024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 582 ms 15948 KB Output is correct
2 Correct 605 ms 15840 KB Output is correct
3 Correct 499 ms 15884 KB Output is correct
4 Correct 581 ms 15944 KB Output is correct
5 Correct 506 ms 15844 KB Output is correct