Submission #432326

# Submission time Handle Problem Language Result Execution time Memory
432326 2021-06-18T08:06:38 Z four_specks Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 48264 KB
#include <bits/stdc++.h>

using namespace std;

void solve()
{
    struct point
    {
        long 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 ended = 0;
        double e = 0.0;
        for (auto [x1, x2] : cov)
        {
            if (x1 <= e)
            {
                e = max(e, x2);
                if (e >= l)
                {
                    ended = 1;
                    break;
                }
            }
            else
                break;
        }

        return ended;
    };

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

    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 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 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 460 KB Output is correct
2 Correct 6 ms 460 KB Output is correct
3 Correct 4 ms 332 KB Output is correct
4 Correct 5 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 608 KB Output is correct
2 Correct 13 ms 616 KB Output is correct
3 Correct 16 ms 604 KB Output is correct
4 Correct 9 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 604 KB Output is correct
2 Correct 13 ms 616 KB Output is correct
3 Correct 18 ms 612 KB Output is correct
4 Correct 11 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 612 KB Output is correct
2 Correct 13 ms 604 KB Output is correct
3 Correct 17 ms 608 KB Output is correct
4 Correct 9 ms 604 KB Output is correct
5 Correct 11 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 220 ms 4868 KB Output is correct
2 Correct 352 ms 4944 KB Output is correct
3 Correct 202 ms 3100 KB Output is correct
4 Correct 180 ms 4756 KB Output is correct
5 Correct 132 ms 2932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 4844 KB Output is correct
2 Correct 194 ms 4616 KB Output is correct
3 Correct 214 ms 4940 KB Output is correct
4 Correct 204 ms 4880 KB Output is correct
5 Correct 193 ms 5116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 382 ms 5152 KB Output is correct
2 Correct 425 ms 5452 KB Output is correct
3 Correct 469 ms 5104 KB Output is correct
4 Correct 206 ms 5504 KB Output is correct
5 Correct 285 ms 5240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 422 ms 5564 KB Output is correct
2 Correct 518 ms 5536 KB Output is correct
3 Correct 578 ms 5652 KB Output is correct
4 Correct 225 ms 5528 KB Output is correct
5 Correct 286 ms 5564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 417 ms 5524 KB Output is correct
2 Correct 527 ms 5544 KB Output is correct
3 Correct 560 ms 5568 KB Output is correct
4 Correct 217 ms 5540 KB Output is correct
5 Correct 263 ms 5540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 24284 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 24280 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 35604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 35656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 38792 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 38728 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 41996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 41976 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 48144 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 48264 KB Time limit exceeded
2 Halted 0 ms 0 KB -