Submission #470629

# Submission time Handle Problem Language Result Execution time Memory
470629 2021-09-04T16:05:04 Z zxcvbnm Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 31560 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;
        if (rep == 0) mid = 1;
        else if (r > 1) mid = sqrt(l * r);

        if (ok(mid)) {
            r = mid;
            ans = mid;
        }
        else {
            l = mid;
        }
    }

    cout << fixed << setprecision(6) << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 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 2 ms 332 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 7 ms 460 KB Output is correct
3 Correct 7 ms 460 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 4 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 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
5 Correct 4 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 86 ms 2636 KB Output is correct
2 Correct 99 ms 2636 KB Output is correct
3 Correct 56 ms 1996 KB Output is correct
4 Correct 62 ms 2636 KB Output is correct
5 Correct 35 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 2764 KB Output is correct
2 Correct 53 ms 2508 KB Output is correct
3 Correct 62 ms 2776 KB Output is correct
4 Correct 78 ms 2744 KB Output is correct
5 Correct 71 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 106 ms 3020 KB Output is correct
2 Correct 119 ms 2892 KB Output is correct
3 Correct 89 ms 2892 KB Output is correct
4 Correct 85 ms 3404 KB Output is correct
5 Correct 68 ms 3020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 125 ms 3404 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 122 ms 3404 KB Output is correct
2 Correct 117 ms 3472 KB Output is correct
3 Correct 110 ms 3404 KB Output is correct
4 Correct 92 ms 3404 KB Output is correct
5 Correct 73 ms 3448 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 596 ms 15948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 625 ms 15948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 701 ms 18996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 718 ms 19020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 803 ms 22220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 884 ms 22116 KB Output is correct
2 Correct 784 ms 22220 KB Output is correct
3 Correct 767 ms 22216 KB Output is correct
4 Correct 617 ms 22180 KB Output is correct
5 Correct 566 ms 22212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 960 ms 25292 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 973 ms 25420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 31556 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 31560 KB Time limit exceeded
2 Halted 0 ms 0 KB -