Submission #432328

# Submission time Handle Problem Language Result Execution time Memory
432328 2021-06-18T08:07:15 Z four_specks Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 48116 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 = 3e9;
    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 0 ms 204 KB Output is correct
2 Correct 1 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 4 ms 460 KB Output is correct
2 Correct 5 ms 460 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 4 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 604 KB Output is correct
2 Correct 13 ms 604 KB Output is correct
3 Correct 13 ms 604 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 604 KB Output is correct
2 Correct 10 ms 604 KB Output is correct
3 Correct 14 ms 668 KB Output is correct
4 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 612 KB Output is correct
2 Correct 10 ms 608 KB Output is correct
3 Correct 18 ms 604 KB Output is correct
4 Correct 6 ms 636 KB Output is correct
5 Correct 8 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 4768 KB Output is correct
2 Correct 279 ms 4808 KB Output is correct
3 Correct 171 ms 3036 KB Output is correct
4 Correct 112 ms 4804 KB Output is correct
5 Correct 92 ms 2932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 152 ms 4856 KB Output is correct
2 Correct 133 ms 4672 KB Output is correct
3 Correct 131 ms 4916 KB Output is correct
4 Correct 114 ms 4856 KB Output is correct
5 Correct 108 ms 5100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 251 ms 5164 KB Output is correct
2 Correct 323 ms 5068 KB Output is correct
3 Correct 364 ms 5048 KB Output is correct
4 Correct 86 ms 5432 KB Output is correct
5 Correct 159 ms 5192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 304 ms 5672 KB Output is correct
2 Correct 419 ms 5656 KB Output is correct
3 Correct 445 ms 5536 KB Output is correct
4 Correct 98 ms 5428 KB Output is correct
5 Correct 162 ms 5528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 255 ms 5544 KB Output is correct
2 Correct 413 ms 5512 KB Output is correct
3 Correct 447 ms 5524 KB Output is correct
4 Correct 91 ms 5612 KB Output is correct
5 Correct 162 ms 5540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 24492 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 24400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 35672 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 35704 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 38932 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1100 ms 38692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 41840 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1092 ms 41820 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 48116 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 48084 KB Time limit exceeded
2 Halted 0 ms 0 KB -