Submission #551989

# Submission time Handle Problem Language Result Execution time Memory
551989 2022-04-22T05:09:55 Z narcissus Mobile (BOI12_mobile) C++17
100 / 100
973 ms 35248 KB
#include <iostream>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;
    pair<long long, long long> coords[n];
    for (int i = 0; i < n; i++) {
        cin >> coords[i].first >> coords[i].second;
    }

    double low = 1, high = 2e9;
    while (high - low > 1e-3) {
        double mid = low + (high - low) / 2;
        // cout << mid << ":" << endl;
        double maxv = 0;
        for (int i = 0; i < n; i++) {
            long long x = coords[i].first;
            long long y = coords[i].second;
            double xdist = sqrt(pow(mid, 2) - pow(y, 2));
            double a1 = x - xdist;
            double a2 = x + xdist;
            // cout << "a " << a1 << ' ' << a2 << endl;
            if (a1 <= maxv)
                maxv = max(maxv, a2);
        }
        if (maxv >= l) {
            high = mid;
        } else {
            low = mid;
        }
    }
    cout << fixed << setprecision(4) << low << endl;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 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 212 KB Output is correct
2 Correct 1 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 2 ms 340 KB Output is correct
2 Correct 2 ms 356 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 4 ms 340 KB Output is correct
2 Correct 4 ms 440 KB Output is correct
3 Correct 4 ms 408 KB Output is correct
4 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 440 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 5 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 420 KB Output is correct
2 Correct 4 ms 436 KB Output is correct
3 Correct 4 ms 312 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 2352 KB Output is correct
2 Correct 59 ms 2484 KB Output is correct
3 Correct 33 ms 1720 KB Output is correct
4 Correct 60 ms 2732 KB Output is correct
5 Correct 29 ms 1364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 2260 KB Output is correct
2 Correct 53 ms 2136 KB Output is correct
3 Correct 59 ms 2556 KB Output is correct
4 Correct 71 ms 2612 KB Output is correct
5 Correct 78 ms 3012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2280 KB Output is correct
2 Correct 64 ms 2704 KB Output is correct
3 Correct 53 ms 2488 KB Output is correct
4 Correct 97 ms 3660 KB Output is correct
5 Correct 59 ms 2556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 3392 KB Output is correct
2 Correct 89 ms 3244 KB Output is correct
3 Correct 63 ms 2844 KB Output is correct
4 Correct 97 ms 3756 KB Output is correct
5 Correct 69 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 3348 KB Output is correct
2 Correct 79 ms 3240 KB Output is correct
3 Correct 64 ms 2968 KB Output is correct
4 Correct 111 ms 3784 KB Output is correct
5 Correct 72 ms 3104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 312 ms 12308 KB Output is correct
2 Correct 396 ms 15692 KB Output is correct
3 Correct 375 ms 15372 KB Output is correct
4 Correct 476 ms 17552 KB Output is correct
5 Correct 390 ms 14864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 451 ms 16408 KB Output is correct
2 Correct 438 ms 14700 KB Output is correct
3 Correct 338 ms 13840 KB Output is correct
4 Correct 466 ms 17436 KB Output is correct
5 Correct 402 ms 15380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 357 ms 14924 KB Output is correct
2 Correct 484 ms 18868 KB Output is correct
3 Correct 455 ms 18376 KB Output is correct
4 Correct 607 ms 21540 KB Output is correct
5 Correct 435 ms 17668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 483 ms 19516 KB Output is correct
2 Correct 521 ms 17584 KB Output is correct
3 Correct 384 ms 16432 KB Output is correct
4 Correct 577 ms 21380 KB Output is correct
5 Correct 477 ms 18372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 399 ms 17288 KB Output is correct
2 Correct 525 ms 21968 KB Output is correct
3 Correct 520 ms 21372 KB Output is correct
4 Correct 732 ms 24656 KB Output is correct
5 Correct 566 ms 20176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 543 ms 22320 KB Output is correct
2 Correct 612 ms 20436 KB Output is correct
3 Correct 482 ms 19616 KB Output is correct
4 Correct 648 ms 24592 KB Output is correct
5 Correct 548 ms 21328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 519 ms 19720 KB Output is correct
2 Correct 600 ms 25184 KB Output is correct
3 Correct 554 ms 24408 KB Output is correct
4 Correct 765 ms 28396 KB Output is correct
5 Correct 585 ms 23940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 633 ms 23636 KB Output is correct
2 Correct 661 ms 23404 KB Output is correct
3 Correct 563 ms 22312 KB Output is correct
4 Correct 957 ms 28136 KB Output is correct
5 Correct 628 ms 24364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 569 ms 24612 KB Output is correct
2 Correct 763 ms 31448 KB Output is correct
3 Correct 765 ms 30464 KB Output is correct
4 Correct 973 ms 16996 KB Output is correct
5 Correct 751 ms 29488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 793 ms 23804 KB Output is correct
2 Correct 822 ms 29224 KB Output is correct
3 Correct 655 ms 28336 KB Output is correct
4 Correct 957 ms 35248 KB Output is correct
5 Correct 799 ms 30780 KB Output is correct