Submission #470621

# Submission time Handle Problem Language Result Execution time Memory
470621 2021-09-04T15:54:56 Z zxcvbnm Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 31620 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 < 60; 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 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 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 332 KB Output is correct
2 Correct 5 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 4 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 7 ms 460 KB Output is correct
4 Correct 6 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 460 KB Output is correct
2 Correct 8 ms 460 KB Output is correct
3 Correct 8 ms 460 KB Output is correct
4 Correct 6 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 460 KB Output is correct
2 Correct 8 ms 460 KB Output is correct
3 Correct 7 ms 460 KB Output is correct
4 Correct 6 ms 460 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 104 ms 2636 KB Output is correct
2 Correct 115 ms 2636 KB Output is correct
3 Correct 77 ms 1996 KB Output is correct
4 Correct 75 ms 2636 KB Output is correct
5 Correct 51 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 2764 KB Output is correct
2 Correct 71 ms 2508 KB Output is correct
3 Correct 80 ms 2764 KB Output is correct
4 Correct 79 ms 2764 KB Output is correct
5 Correct 84 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 129 ms 3020 KB Output is correct
2 Correct 125 ms 2892 KB Output is correct
3 Correct 114 ms 2892 KB Output is correct
4 Correct 99 ms 3404 KB Output is correct
5 Correct 87 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 151 ms 3404 KB Output is correct
2 Correct 150 ms 3404 KB Output is correct
3 Correct 134 ms 3404 KB Output is correct
4 Correct 101 ms 3404 KB Output is correct
5 Correct 100 ms 3404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 3404 KB Output is correct
2 Correct 156 ms 3404 KB Output is correct
3 Correct 133 ms 3404 KB Output is correct
4 Correct 100 ms 3404 KB Output is correct
5 Correct 97 ms 3404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 747 ms 15912 KB Output is correct
2 Correct 782 ms 15948 KB Output is correct
3 Correct 761 ms 15948 KB Output is correct
4 Correct 495 ms 15948 KB Output is correct
5 Correct 515 ms 15948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 774 ms 15948 KB Output is correct
2 Correct 733 ms 15948 KB Output is correct
3 Correct 659 ms 15916 KB Output is correct
4 Correct 508 ms 15948 KB Output is correct
5 Correct 503 ms 15948 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 887 ms 19012 KB Output is correct
2 Correct 923 ms 19020 KB Output is correct
3 Correct 926 ms 19044 KB Output is correct
4 Correct 606 ms 19020 KB Output is correct
5 Correct 601 ms 19020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 913 ms 19020 KB Output is correct
2 Correct 867 ms 19020 KB Output is correct
3 Correct 774 ms 19044 KB Output is correct
4 Correct 596 ms 19064 KB Output is correct
5 Correct 592 ms 19020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 22160 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 22220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1096 ms 25292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 25332 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 31620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 31564 KB Time limit exceeded
2 Halted 0 ms 0 KB -