Submission #990318

# Submission time Handle Problem Language Result Execution time Memory
990318 2024-05-30T07:58:07 Z Ska Mobile (BOI12_mobile) C++14
4 / 100
938 ms 13732 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 1e5 + 5;

int n;
long double m;
long double x[N], y[N];

pair<long double, long double> calc(long double r, int i) {
    if (r < y[i]) {
        return {-1, -1};
    }
    return {x[i] - sqrtl(r * r - y[i] * y[i]), x[i] + sqrtl(r * r - y[i] * y[i])};
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    long double l = 2e9, r = 2e9;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> y[i];
        l = min(l, abs(y[i]));
    }
    int iter = 50;
    while (iter--) {
        vector<pair<long double, long double>> segments;
        long double mid = (l + r) / 2;
        for (int i = 1; i <= n; ++i) {
            auto x = calc(mid, i);
            if (x.first != -1 && x.second != -1) {
                segments.emplace_back(x.first, x.second);
            }
        }
        sort(segments.begin(), segments.end());
        long double bound = 0;
        for (auto x : segments) {
            if (x.first > bound) {
                break;
            }
            bound = max(bound, x.second);
            if (bound >= m) {
                break;
            }
        }
        if (bound >= m) {
            r = mid;
        } else {
            l = mid;
        }
    }
    cout << fixed << setprecision(6) << l << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2820 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 3052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3056 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 23 ms 3072 KB Output is correct
2 Correct 23 ms 3328 KB Output is correct
3 Correct 31 ms 3056 KB Output is correct
4 Incorrect 30 ms 3108 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 278 ms 10524 KB Output is correct
2 Correct 521 ms 11512 KB Output is correct
3 Correct 340 ms 7240 KB Output is correct
4 Incorrect 553 ms 12012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 524 ms 11060 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 443 ms 11484 KB Output is correct
2 Correct 552 ms 12252 KB Output is correct
3 Correct 749 ms 11312 KB Output is correct
4 Incorrect 738 ms 13732 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 551 ms 13456 KB Output is correct
2 Correct 704 ms 12192 KB Output is correct
3 Correct 938 ms 13012 KB Output is correct
4 Incorrect 834 ms 12740 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 496 ms 12328 KB Output is correct
2 Correct 702 ms 13260 KB Output is correct
3 Correct 921 ms 12532 KB Output is correct
4 Incorrect 868 ms 12636 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 5456 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 5212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4436 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 28 ms 5204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 37 ms 5324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 5292 KB Output isn't correct
2 Halted 0 ms 0 KB -