Submission #470622

# Submission time Handle Problem Language Result Execution time Memory
470622 2021-09-04T15:55:34 Z zxcvbnm Mobile (BOI12_mobile) C++14
90 / 100
1000 ms 40772 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct P {
    ld x, y;
};
vector<P> a;
int n, L;
bool ok(ld r) {
    ld curr = 0;
    for(int i = 0; i < n; i++) {
        if (r * r < a[i].y * a[i].y) continue;
        ld sol = sqrt(r * r - a[i].y * a[i].y);
        ld left = max((ld) 0, a[i].x - sol);
        ld right = min((ld) L, a[i].x + sol);
        if (left <= curr) {
            curr = max(curr, right);
        }
    }

    return curr >= L;
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> L;
    a.resize(n);
    for(auto& i : a) {
        cin >> i.x >> i.y;
    }

    ld l = 0, r = 1e9;
    ld ans = r;
    for(int rep = 0; rep < 40; rep++) {
        ld mid = (l + r) / 2;
//        cout << mid << "\n";
        if (ok(mid)) {
            r = mid;
            ans = mid;
        }
        else {
            l = mid;
        }
    }

    cout << fixed << setprecision(6) << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 408 KB Output is correct
2 Correct 3 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 460 KB Output is correct
2 Correct 8 ms 460 KB Output is correct
3 Correct 6 ms 460 KB Output is correct
4 Correct 5 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 460 KB Output is correct
2 Correct 6 ms 460 KB Output is correct
3 Correct 5 ms 460 KB Output is correct
4 Correct 5 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 460 KB Output is correct
2 Correct 7 ms 460 KB Output is correct
3 Correct 6 ms 460 KB Output is correct
4 Correct 7 ms 460 KB Output is correct
5 Correct 5 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 2636 KB Output is correct
2 Correct 95 ms 2636 KB Output is correct
3 Correct 62 ms 1996 KB Output is correct
4 Correct 69 ms 2636 KB Output is correct
5 Correct 47 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 76 ms 2764 KB Output is correct
2 Correct 66 ms 2508 KB Output is correct
3 Correct 77 ms 2764 KB Output is correct
4 Correct 75 ms 2764 KB Output is correct
5 Correct 86 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 3020 KB Output is correct
2 Correct 102 ms 2892 KB Output is correct
3 Correct 92 ms 2892 KB Output is correct
4 Correct 90 ms 3404 KB Output is correct
5 Correct 82 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 121 ms 3404 KB Output is correct
2 Correct 120 ms 3404 KB Output is correct
3 Correct 111 ms 3368 KB Output is correct
4 Correct 90 ms 3404 KB Output is correct
5 Correct 91 ms 3404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 130 ms 3404 KB Output is correct
2 Correct 121 ms 3404 KB Output is correct
3 Correct 110 ms 3404 KB Output is correct
4 Correct 91 ms 3404 KB Output is correct
5 Correct 91 ms 3404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 579 ms 15948 KB Output is correct
2 Correct 618 ms 15948 KB Output is correct
3 Correct 628 ms 15948 KB Output is correct
4 Correct 450 ms 15948 KB Output is correct
5 Correct 463 ms 15884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 620 ms 15948 KB Output is correct
2 Correct 589 ms 15876 KB Output is correct
3 Correct 535 ms 15948 KB Output is correct
4 Correct 454 ms 15948 KB Output is correct
5 Correct 450 ms 15948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 700 ms 19020 KB Output is correct
2 Correct 737 ms 19020 KB Output is correct
3 Correct 739 ms 19020 KB Output is correct
4 Correct 544 ms 19020 KB Output is correct
5 Correct 557 ms 19020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 756 ms 19020 KB Output is correct
2 Correct 694 ms 18996 KB Output is correct
3 Correct 640 ms 19020 KB Output is correct
4 Correct 541 ms 19020 KB Output is correct
5 Correct 542 ms 19020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 818 ms 22220 KB Output is correct
2 Correct 878 ms 32964 KB Output is correct
3 Correct 853 ms 32332 KB Output is correct
4 Correct 674 ms 35652 KB Output is correct
5 Correct 662 ms 31172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 864 ms 22200 KB Output is correct
2 Correct 795 ms 31432 KB Output is correct
3 Correct 766 ms 30536 KB Output is correct
4 Correct 644 ms 35536 KB Output is correct
5 Correct 641 ms 32452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 930 ms 25292 KB Output is correct
2 Correct 993 ms 37700 KB Output is correct
3 Correct 993 ms 36872 KB Output is correct
4 Correct 731 ms 40024 KB Output is correct
5 Correct 744 ms 36484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 994 ms 25284 KB Output is correct
2 Correct 911 ms 35908 KB Output is correct
3 Correct 867 ms 34820 KB Output is correct
4 Correct 734 ms 40772 KB Output is correct
5 Correct 730 ms 36876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 31564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 31512 KB Time limit exceeded
2 Halted 0 ms 0 KB -