Submission #702624

# Submission time Handle Problem Language Result Execution time Memory
702624 2023-02-24T15:21:26 Z nguyennehehe Mobile (BOI12_mobile) C++14
50 / 100
1000 ms 40508 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)
            if (sqr(R) - sqr(v) < 0) continue;
            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());
        double l = 0;
        for (auto i: b) {
            if (i.first <= l) l = max(l, i.second);
        }
        return l >= L;
    };

    double l = -1, r = 1e9 + 1;
    for (int i = 1, ITER = 100; i <= ITER; ++i) {
        double m = l + (r - l) / 2;
        if (good(m)) r = m;
        else l = m;
    }
    cout << fixed << setprecision(9) << r;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 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 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 7 ms 468 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 564 KB Output is correct
2 Correct 15 ms 644 KB Output is correct
3 Correct 21 ms 608 KB Output is correct
4 Correct 6 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 572 KB Output is correct
2 Correct 14 ms 1028 KB Output is correct
3 Correct 24 ms 612 KB Output is correct
4 Correct 5 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 932 KB Output is correct
2 Correct 13 ms 644 KB Output is correct
3 Correct 26 ms 604 KB Output is correct
4 Correct 5 ms 660 KB Output is correct
5 Correct 7 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 175 ms 4400 KB Output is correct
2 Correct 462 ms 5428 KB Output is correct
3 Correct 293 ms 3236 KB Output is correct
4 Correct 82 ms 5308 KB Output is correct
5 Correct 75 ms 2932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 4236 KB Output is correct
2 Correct 106 ms 4876 KB Output is correct
3 Correct 100 ms 5280 KB Output is correct
4 Correct 91 ms 5452 KB Output is correct
5 Correct 81 ms 5884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 365 ms 4616 KB Output is correct
2 Correct 506 ms 5480 KB Output is correct
3 Correct 682 ms 5360 KB Output is correct
4 Correct 70 ms 6572 KB Output is correct
5 Correct 125 ms 5440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 505 ms 4752 KB Output is correct
2 Correct 678 ms 6160 KB Output is correct
3 Correct 941 ms 5804 KB Output is correct
4 Correct 68 ms 6608 KB Output is correct
5 Correct 127 ms 5972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 341 ms 4872 KB Output is correct
2 Correct 666 ms 6164 KB Output is correct
3 Correct 894 ms 5784 KB Output is correct
4 Correct 69 ms 6560 KB Output is correct
5 Correct 126 ms 6020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 20548 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 20376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1061 ms 31088 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 30888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 33304 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 33220 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1037 ms 35724 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 35704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 40308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 40508 KB Time limit exceeded
2 Halted 0 ms 0 KB -