Submission #550699

# Submission time Handle Problem Language Result Execution time Memory
550699 2022-04-18T21:06:25 Z FromDihPout Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 55084 KB
/**
 *    author:  FromDihPout
 *    created: 2022-04-18
**/
 
#include <bits/stdc++.h>
using namespace std;

const double EPSILON = 1e-5;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, l;
    cin >> n >> l;
    vector<array<int, 2>> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p[i][0] >> p[i][1];
    }

    auto check = [&](double r) {
        vector<pair<double, double>> intervals(n);
        for (int i = 0; i < n; i++) {
            if (p[i][1] >= r) continue;
            double length = sqrt((r * r) - (p[i][1] * p[i][1]));
            intervals.emplace_back(p[i][0] - length, p[i][0] + length);
        }
        sort(intervals.begin(), intervals.end());

        double end = 0.0;
        for (auto [l, r] : intervals) {
            if (l > end) {
                return false;
            }
            end = max(end, r);
        }
        return end >= l;
    };

    double lo = 0, hi = 1e10;
    while (hi - lo > EPSILON) {
        double mid = (lo + hi) / 2;
        if (check(mid)) {
            hi = mid;
        } else {
            lo = mid;
        }
    }
    cout << fixed << setprecision(5) << lo << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB Output is correct
2 Correct 6 ms 400 KB Output is correct
3 Correct 6 ms 340 KB Output is correct
4 Incorrect 8 ms 448 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 604 KB Output is correct
2 Correct 17 ms 664 KB Output is correct
3 Correct 15 ms 636 KB Output is correct
4 Incorrect 16 ms 660 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 17 ms 604 KB Output is correct
2 Correct 15 ms 760 KB Output is correct
3 Correct 18 ms 636 KB Output is correct
4 Incorrect 17 ms 660 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 600 KB Output is correct
2 Correct 15 ms 668 KB Output is correct
3 Correct 16 ms 788 KB Output is correct
4 Incorrect 16 ms 684 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 218 ms 4332 KB Output is correct
2 Incorrect 311 ms 5468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 265 ms 4576 KB Output is correct
2 Correct 249 ms 4964 KB Output is correct
3 Incorrect 320 ms 5708 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 414 ms 5048 KB Output is correct
2 Incorrect 331 ms 5944 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 359 ms 5720 KB Output is correct
2 Incorrect 456 ms 7140 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 365 ms 5748 KB Output is correct
2 Incorrect 435 ms 7140 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 27652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 27636 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1089 ms 33244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 33204 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 38640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 38628 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 44192 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 44128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 55084 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1059 ms 54996 KB Time limit exceeded
2 Halted 0 ms 0 KB -