Submission #973132

# Submission time Handle Problem Language Result Execution time Memory
973132 2024-05-01T14:06:20 Z njoop Mobile (BOI12_mobile) C++17
100 / 100
860 ms 52704 KB
#include <bits/stdc++.h>
#define pi pair<double, double>
using namespace std;

double x, y, L, l=0, r=1e9, mid, de, cov;
pi arr[1000010];
vector<pi> in;
int n;

bool solve(double rad) {
    in.clear();
    cov = 0;
    for(int i=1; i<=n; i++) {
        de = sqrt(rad*rad - arr[i].second*arr[i].second);
        in.push_back({arr[i].first-de, arr[i].first+de});
    }
    for(auto i: in) {
        if(i.first <= cov) cov = max(cov, i.second);
    }
    if(cov >= L) return 1;
    else return 0;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n >> L;
    for(int i=1; i<=n; i++) {
        cin >> arr[i].first >> arr[i].second;
    }
    while(l+0.0001 < r) {
        mid = (l+r)/2;
        if(solve(mid)) {
            r = mid;
        } else {
            l = mid + 0.0001;
        }
    }
    cout << fixed << setprecision(6) << l;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 516 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 600 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 4 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 604 KB Output is correct
2 Correct 4 ms 604 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 676 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 4824 KB Output is correct
2 Correct 63 ms 5836 KB Output is correct
3 Correct 42 ms 4580 KB Output is correct
4 Correct 64 ms 5840 KB Output is correct
5 Correct 40 ms 4224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 58 ms 4816 KB Output is correct
2 Correct 55 ms 5584 KB Output is correct
3 Correct 63 ms 5836 KB Output is correct
4 Correct 62 ms 6104 KB Output is correct
5 Correct 69 ms 6360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 4820 KB Output is correct
2 Correct 60 ms 5120 KB Output is correct
3 Correct 61 ms 4824 KB Output is correct
4 Correct 83 ms 4816 KB Output is correct
5 Correct 69 ms 5592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 75 ms 4780 KB Output is correct
2 Correct 73 ms 4816 KB Output is correct
3 Correct 70 ms 4864 KB Output is correct
4 Correct 84 ms 4812 KB Output is correct
5 Correct 79 ms 5996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 4844 KB Output is correct
2 Correct 84 ms 4812 KB Output is correct
3 Correct 71 ms 4824 KB Output is correct
4 Correct 83 ms 4820 KB Output is correct
5 Correct 77 ms 6092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 354 ms 18672 KB Output is correct
2 Correct 377 ms 18388 KB Output is correct
3 Correct 363 ms 18428 KB Output is correct
4 Correct 415 ms 17604 KB Output is correct
5 Correct 391 ms 25284 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 375 ms 18928 KB Output is correct
2 Correct 417 ms 18628 KB Output is correct
3 Correct 360 ms 23240 KB Output is correct
4 Correct 412 ms 27472 KB Output is correct
5 Correct 423 ms 26308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 423 ms 28872 KB Output is correct
2 Correct 454 ms 28648 KB Output is correct
3 Correct 461 ms 37436 KB Output is correct
4 Correct 518 ms 40296 KB Output is correct
5 Correct 502 ms 36552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 450 ms 28148 KB Output is correct
2 Correct 498 ms 28612 KB Output is correct
3 Correct 429 ms 35672 KB Output is correct
4 Correct 549 ms 40788 KB Output is correct
5 Correct 512 ms 37824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 555 ms 29680 KB Output is correct
2 Correct 530 ms 31472 KB Output is correct
3 Correct 528 ms 40536 KB Output is correct
4 Correct 605 ms 44896 KB Output is correct
5 Correct 564 ms 38452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 525 ms 30700 KB Output is correct
2 Correct 588 ms 30968 KB Output is correct
3 Correct 522 ms 39012 KB Output is correct
4 Correct 609 ms 44736 KB Output is correct
5 Correct 556 ms 40640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 575 ms 31984 KB Output is correct
2 Correct 611 ms 31424 KB Output is correct
3 Correct 603 ms 43588 KB Output is correct
4 Correct 675 ms 47044 KB Output is correct
5 Correct 636 ms 43484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 607 ms 32452 KB Output is correct
2 Correct 649 ms 31984 KB Output is correct
3 Correct 587 ms 41928 KB Output is correct
4 Correct 683 ms 48608 KB Output is correct
5 Correct 654 ms 44004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 712 ms 32708 KB Output is correct
2 Correct 860 ms 34544 KB Output is correct
3 Correct 762 ms 47444 KB Output is correct
4 Correct 841 ms 52420 KB Output is correct
5 Correct 811 ms 47804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 774 ms 34200 KB Output is correct
2 Correct 818 ms 33984 KB Output is correct
3 Correct 772 ms 45924 KB Output is correct
4 Correct 858 ms 52704 KB Output is correct
5 Correct 801 ms 48848 KB Output is correct