Submission #550723

# Submission time Handle Problem Language Result Execution time Memory
550723 2022-04-18T21:52:58 Z FromDihPout Mobile (BOI12_mobile) C++17
100 / 100
857 ms 29516 KB
/**
 *    author:  FromDihPout
 *    created: 2022-04-18
**/
 
#include <bits/stdc++.h>
using namespace std;

const double EPSILON = 1e-3;

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

    int n, l;
    cin >> n >> l;
    vector<array<double, 2>> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i][0] >> p[i][1];
    }

    auto check = [&](double r) {
        double end = 0;
        for (int i = 0; i < n; i++) {
            if (p[i][1] >= r) continue;
            double length = sqrt((r * r) - (p[i][1] * p[i][1]));
            double left = p[i][0] - length, right = p[i][0] + length;
            if (left <= end) {
                end = max(end, right);
            }
        }
        return end >= l;
    };

    double lo = 0, hi = 3e9;
    while (hi - lo > EPSILON) {
        double mid = (lo + hi) / 2;
        if (check(mid)) {
            hi = mid;
        } else {
            lo = mid;
        }
    }
    cout << fixed << setprecision(4) << lo << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 320 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 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 4 ms 340 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 4 ms 464 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 456 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 436 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 2256 KB Output is correct
2 Correct 47 ms 2532 KB Output is correct
3 Correct 29 ms 1664 KB Output is correct
4 Correct 63 ms 2632 KB Output is correct
5 Correct 24 ms 1480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2172 KB Output is correct
2 Correct 49 ms 2180 KB Output is correct
3 Correct 56 ms 2612 KB Output is correct
4 Correct 65 ms 2704 KB Output is correct
5 Correct 72 ms 3076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2336 KB Output is correct
2 Correct 51 ms 2752 KB Output is correct
3 Correct 42 ms 2532 KB Output is correct
4 Correct 92 ms 3772 KB Output is correct
5 Correct 54 ms 2592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 3408 KB Output is correct
2 Correct 60 ms 3280 KB Output is correct
3 Correct 49 ms 2892 KB Output is correct
4 Correct 92 ms 3780 KB Output is correct
5 Correct 70 ms 3032 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 3272 KB Output is correct
2 Correct 59 ms 3272 KB Output is correct
3 Correct 50 ms 2892 KB Output is correct
4 Correct 91 ms 3788 KB Output is correct
5 Correct 71 ms 3144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 246 ms 12344 KB Output is correct
2 Correct 304 ms 15052 KB Output is correct
3 Correct 314 ms 15052 KB Output is correct
4 Correct 433 ms 13752 KB Output is correct
5 Correct 360 ms 14928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 313 ms 13440 KB Output is correct
2 Correct 316 ms 14664 KB Output is correct
3 Correct 252 ms 13756 KB Output is correct
4 Correct 445 ms 13800 KB Output is correct
5 Correct 374 ms 15048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 297 ms 14824 KB Output is correct
2 Correct 362 ms 15364 KB Output is correct
3 Correct 358 ms 15932 KB Output is correct
4 Correct 529 ms 13332 KB Output is correct
5 Correct 427 ms 16308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 377 ms 14112 KB Output is correct
2 Correct 377 ms 16428 KB Output is correct
3 Correct 311 ms 16468 KB Output is correct
4 Correct 533 ms 13628 KB Output is correct
5 Correct 467 ms 15824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 350 ms 16888 KB Output is correct
2 Correct 425 ms 16076 KB Output is correct
3 Correct 410 ms 16332 KB Output is correct
4 Correct 608 ms 15100 KB Output is correct
5 Correct 495 ms 17312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 436 ms 14412 KB Output is correct
2 Correct 436 ms 17232 KB Output is correct
3 Correct 359 ms 17764 KB Output is correct
4 Correct 600 ms 15004 KB Output is correct
5 Correct 518 ms 16068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 396 ms 18724 KB Output is correct
2 Correct 477 ms 16524 KB Output is correct
3 Correct 462 ms 16544 KB Output is correct
4 Correct 695 ms 16432 KB Output is correct
5 Correct 569 ms 16700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 500 ms 16600 KB Output is correct
2 Correct 481 ms 16972 KB Output is correct
3 Correct 419 ms 17608 KB Output is correct
4 Correct 686 ms 16460 KB Output is correct
5 Correct 588 ms 15948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 490 ms 21068 KB Output is correct
2 Correct 608 ms 18984 KB Output is correct
3 Correct 596 ms 19176 KB Output is correct
4 Correct 857 ms 16476 KB Output is correct
5 Correct 716 ms 29516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 646 ms 18252 KB Output is correct
2 Correct 608 ms 19040 KB Output is correct
3 Correct 522 ms 18780 KB Output is correct
4 Correct 855 ms 16340 KB Output is correct
5 Correct 767 ms 18636 KB Output is correct