Submission #550702

# Submission time Handle Problem Language Result Execution time Memory
550702 2022-04-18T21:10:47 Z FromDihPout Mobile (BOI12_mobile) C++17
36 / 100
1000 ms 63392 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<double, 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 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 212 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 8 ms 468 KB Output is correct
2 Correct 8 ms 512 KB Output is correct
3 Correct 7 ms 460 KB Output is correct
4 Incorrect 11 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 688 KB Output is correct
2 Correct 17 ms 704 KB Output is correct
3 Correct 19 ms 676 KB Output is correct
4 Correct 18 ms 708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 692 KB Output is correct
2 Correct 17 ms 708 KB Output is correct
3 Correct 19 ms 844 KB Output is correct
4 Correct 24 ms 872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 696 KB Output is correct
2 Correct 17 ms 704 KB Output is correct
3 Correct 19 ms 676 KB Output is correct
4 Correct 18 ms 724 KB Output is correct
5 Correct 17 ms 672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 233 ms 5264 KB Output is correct
2 Correct 351 ms 6108 KB Output is correct
3 Correct 197 ms 4264 KB Output is correct
4 Correct 271 ms 6136 KB Output is correct
5 Correct 167 ms 3752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 299 ms 5496 KB Output is correct
2 Correct 257 ms 5532 KB Output is correct
3 Correct 318 ms 6376 KB Output is correct
4 Correct 291 ms 6416 KB Output is correct
5 Correct 349 ms 7144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 435 ms 5964 KB Output is correct
2 Correct 391 ms 6448 KB Output is correct
3 Correct 362 ms 6496 KB Output is correct
4 Incorrect 390 ms 8468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 397 ms 7044 KB Output is correct
2 Correct 520 ms 7544 KB Output is correct
3 Correct 413 ms 7552 KB Output is correct
4 Correct 405 ms 8432 KB Output is correct
5 Correct 379 ms 7808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 421 ms 7040 KB Output is correct
2 Correct 480 ms 7544 KB Output is correct
3 Correct 459 ms 7532 KB Output is correct
4 Incorrect 372 ms 8480 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 32044 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 32164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 38392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1074 ms 38212 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 44652 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1077 ms 44492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 50868 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 50836 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1052 ms 63392 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 62924 KB Time limit exceeded
2 Halted 0 ms 0 KB -