Submission #702611

# Submission time Handle Problem Language Result Execution time Memory
702611 2023-02-24T15:02:50 Z nguyennehehe Mobile (BOI12_mobile) C++14
0 / 100
1000 ms 40532 KB
#include "bits/stdc++.h"
using namespace std;

const int INF = 1e9 + 7;

int32_t main() {
    cin.tie(0)->sync_with_stdio(0);
    
    int n, L; cin >> n >> L;
    vector<pair<int, int>> a(n);
    for (auto &x: a) cin >> x.first >> x.second;

    auto good = [&](double R) {
        vector<pair<double, double>> b;
        for (auto i: a) {
            long long u, v; tie(u, v) = i;
            #define sqr(x) (x) * (x)
            double delta = sqrt(sqr(R) - sqr(v));
            double x1 = -delta + u, x2 = delta + u;
            b.emplace_back(x1, x2);
            // cout << fixed << setprecision(10) << x1 << ' ' << x2 << '\n';
        }
        
        sort(b.begin(), b.end(), [](pair<double, double> x, pair<double, double> y) {
            if (x.second == y.second) return x.first < y.first;
            return x.second < y.second;
        });
        double l = INF, r = -INF;
        for (auto i: b) {
            if (l == INF) {
                l = min(l, i.first);
                r = max(r, i.second);
                continue;
            }
            if (i.second < l || i.first > r) return false;
            l = min(l, i.first), r = max(r, i.second);
        }
        return l <= 0 && r >= L;
    };

    double l = -1, r = 1e9 + 1;
    for (int i = 1, ITER = 80; i <= ITER; ++i) {
        double m = l + (r - l) / 2;
        if (good(m)) r = m;
        else l = m;
    }
    cout << fixed << setprecision(20) << r;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 612 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 636 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 664 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 486 ms 4436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 437 ms 4480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 322 ms 4640 KB Output is correct
2 Correct 466 ms 4564 KB Output is correct
3 Correct 529 ms 4572 KB Output is correct
4 Incorrect 796 ms 5084 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 474 ms 5020 KB Output is correct
2 Correct 580 ms 5116 KB Output is correct
3 Correct 451 ms 4916 KB Output is correct
4 Incorrect 717 ms 5068 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 359 ms 5140 KB Output is correct
2 Correct 586 ms 5008 KB Output is correct
3 Correct 433 ms 4896 KB Output is correct
4 Incorrect 656 ms 5012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1022 ms 20696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 20664 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1050 ms 31252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1043 ms 31296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1063 ms 33544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1058 ms 33588 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1075 ms 35872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 35976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 40532 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 40284 KB Time limit exceeded
2 Halted 0 ms 0 KB -