Submission #432277

# Submission time Handle Problem Language Result Execution time Memory
432277 2021-06-18T07:07:23 Z four_specks Mobile (BOI12_mobile) C++17
8 / 100
1000 ms 40332 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)
        {
            if (y * y <= d * d)
            {
                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-6;)
    {
        if (double mid = (lo + ans) / 2.0; valid(mid))
            ans = mid;
        else
            lo = mid + 1e-5;
    }

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

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

    solve();

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 332 KB Output is correct
2 Correct 7 ms 460 KB Output is correct
3 Correct 5 ms 332 KB Output is correct
4 Incorrect 6 ms 460 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 580 KB Output is correct
2 Correct 15 ms 636 KB Output is correct
3 Correct 19 ms 748 KB Output is correct
4 Incorrect 18 ms 636 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 568 KB Output is correct
2 Correct 19 ms 636 KB Output is correct
3 Correct 17 ms 604 KB Output is correct
4 Incorrect 14 ms 636 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 556 KB Output is correct
2 Correct 14 ms 556 KB Output is correct
3 Correct 23 ms 556 KB Output is correct
4 Incorrect 14 ms 656 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 248 ms 4316 KB Output is correct
2 Incorrect 367 ms 5400 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 222 ms 4264 KB Output is correct
2 Correct 196 ms 4872 KB Output is correct
3 Incorrect 332 ms 5292 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 323 ms 4696 KB Output is correct
2 Incorrect 413 ms 4404 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 448 ms 4744 KB Output is correct
2 Incorrect 520 ms 4824 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 370 ms 4788 KB Output is correct
2 Incorrect 503 ms 4756 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 20400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 20612 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 31140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 30864 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 33272 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1067 ms 33208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 35620 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 35572 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 40320 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 40332 KB Time limit exceeded
2 Halted 0 ms 0 KB -