Submission #470620

# Submission time Handle Problem Language Result Execution time Memory
470620 2021-09-04T15:52:40 Z zxcvbnm Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 31564 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 = 1e10;
    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(4) << 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 1 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 312 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 4 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 6 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 7 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 9 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 106 ms 2636 KB Output is correct
2 Correct 120 ms 3784 KB Output is correct
3 Correct 71 ms 2508 KB Output is correct
4 Correct 80 ms 3808 KB Output is correct
5 Correct 53 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 82 ms 2764 KB Output is correct
2 Correct 77 ms 3288 KB Output is correct
3 Correct 89 ms 3780 KB Output is correct
4 Correct 83 ms 3948 KB Output is correct
5 Correct 91 ms 4432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 128 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 101 ms 3404 KB Output is correct
5 Correct 91 ms 3996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 156 ms 3404 KB Output is correct
2 Correct 151 ms 3384 KB Output is correct
3 Correct 135 ms 3404 KB Output is correct
4 Correct 102 ms 3404 KB Output is correct
5 Correct 103 ms 4676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 160 ms 3404 KB Output is correct
2 Correct 152 ms 4864 KB Output is correct
3 Correct 134 ms 4420 KB Output is correct
4 Correct 105 ms 5360 KB Output is correct
5 Correct 105 ms 4596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 751 ms 15948 KB Output is correct
2 Correct 770 ms 15948 KB Output is correct
3 Correct 755 ms 15948 KB Output is correct
4 Correct 518 ms 15948 KB Output is correct
5 Correct 520 ms 22736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 771 ms 15948 KB Output is correct
2 Correct 756 ms 15948 KB Output is correct
3 Correct 663 ms 21700 KB Output is correct
4 Correct 522 ms 25284 KB Output is correct
5 Correct 511 ms 23236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 888 ms 19020 KB Output is correct
2 Correct 928 ms 19020 KB Output is correct
3 Correct 914 ms 19020 KB Output is correct
4 Correct 615 ms 19148 KB Output is correct
5 Correct 633 ms 27076 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 939 ms 19012 KB Output is correct
2 Correct 882 ms 19020 KB Output is correct
3 Correct 792 ms 25868 KB Output is correct
4 Correct 627 ms 30744 KB Output is correct
5 Correct 638 ms 27716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1039 ms 22220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 22220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 25292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 25288 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 31564 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 31516 KB Time limit exceeded
2 Halted 0 ms 0 KB -