Submission #432272

# Submission time Handle Problem Language Result Execution time Memory
432272 2021-06-18T07:00:15 Z four_specks Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 40360 KB
#include <bits/stdc++.h>

using namespace std;

void solve()
{
    struct point
    {
        int x, y;
    };

    int n;
    long l;
    cin >> n >> l;

    vector<point> coords(n);
    for (int i = 0; i < n; i++)
        cin >> coords[i].x >> coords[i].y;

    auto valid = [&](const double &d) -> bool
    {
        vector<pair<double, double>> cov;
        for (auto [x, y] : coords)
        {
            double h = sqrt(d * d - y * y);
            cov.emplace_back(x - h, x + h);
        }

        sort(cov.begin(), cov.end());

        bool ok = 1, ended = 0;
        double e = 0.0;
        for (auto [x1, x2] : cov)
        {
            ok &= x1 <= e;
            e = max(e, x2);

            if (e >= l)
                ended = 1;
        }

        return ok && ended;
    };

    double ans = 1e15;
    for (double lo = 1.0; ans - lo > 1e-5;)
    {
        if (double mid = (lo + ans) / 2.0; valid(mid))
            ans = mid;
        else
            lo = mid + 1e-4;
    }

    cout << fixed << setprecision(4) << ans << '\n';
}

int main()
{
    ios_base::sync_with_stdio(false), cin.tie(NULL);

    solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 568 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 556 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 572 KB Output is correct
2 Correct 15 ms 576 KB Output is correct
3 Incorrect 20 ms 572 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 335 ms 4184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 458 ms 4256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 311 ms 4488 KB Output is correct
2 Incorrect 436 ms 5540 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 389 ms 4756 KB Output is correct
2 Incorrect 516 ms 4748 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 351 ms 4760 KB Output is correct
2 Incorrect 493 ms 4760 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1064 ms 20452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1080 ms 20576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 30872 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 30968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 33300 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 33272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 35716 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 35576 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 40280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 40360 KB Time limit exceeded
2 Halted 0 ms 0 KB -