Submission #702625

# Submission time Handle Problem Language Result Execution time Memory
702625 2023-02-24T15:31:50 Z nguyennehehe Mobile (BOI12_mobile) C++14
60 / 100
1000 ms 40388 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 0 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 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 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 564 KB Output is correct
2 Correct 8 ms 564 KB Output is correct
3 Correct 3 ms 580 KB Output is correct
4 Correct 3 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 564 KB Output is correct
2 Correct 6 ms 580 KB Output is correct
3 Correct 6 ms 564 KB Output is correct
4 Correct 3 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 564 KB Output is correct
2 Correct 6 ms 564 KB Output is correct
3 Correct 4 ms 564 KB Output is correct
4 Correct 3 ms 564 KB Output is correct
5 Correct 3 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 4252 KB Output is correct
2 Correct 175 ms 4376 KB Output is correct
3 Correct 73 ms 2688 KB Output is correct
4 Correct 36 ms 4184 KB Output is correct
5 Correct 26 ms 2600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 46 ms 4312 KB Output is correct
2 Correct 40 ms 4100 KB Output is correct
3 Correct 57 ms 4296 KB Output is correct
4 Correct 37 ms 4276 KB Output is correct
5 Correct 38 ms 4392 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 152 ms 4768 KB Output is correct
2 Correct 148 ms 4636 KB Output is correct
3 Correct 60 ms 4404 KB Output is correct
4 Correct 36 ms 4668 KB Output is correct
5 Correct 47 ms 4548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 171 ms 5000 KB Output is correct
2 Correct 164 ms 4932 KB Output is correct
3 Correct 141 ms 4784 KB Output is correct
4 Correct 41 ms 4660 KB Output is correct
5 Correct 48 ms 4776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 169 ms 4888 KB Output is correct
2 Correct 166 ms 4788 KB Output is correct
3 Correct 146 ms 4768 KB Output is correct
4 Correct 37 ms 4656 KB Output is correct
5 Correct 49 ms 4788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 951 ms 20588 KB Output is correct
2 Correct 975 ms 22992 KB Output is correct
3 Correct 917 ms 23016 KB Output is correct
4 Correct 188 ms 22632 KB Output is correct
5 Correct 307 ms 27172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 910 ms 20656 KB Output is correct
2 Correct 686 ms 22860 KB Output is correct
3 Correct 776 ms 26104 KB Output is correct
4 Correct 196 ms 29620 KB Output is correct
5 Correct 236 ms 27656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 31292 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 31024 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1069 ms 33424 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1068 ms 33328 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1076 ms 35856 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 35676 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 40348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1072 ms 40388 KB Time limit exceeded
2 Halted 0 ms 0 KB -