Submission #432302

# Submission time Handle Problem Language Result Execution time Memory
432302 2021-06-18T07:47:53 Z four_specks Mobile (BOI12_mobile) C++17
50 / 100
1000 ms 48188 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());

        // for (auto [x1, x2] : cov)
        //     cerr << x1 << ' ' << x2 << '\n';

        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;
    };

    valid(6);

    double ans = 1e15;
    for (double lo = 0.5; 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 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 7 ms 460 KB Output is correct
3 Correct 5 ms 404 KB Output is correct
4 Correct 6 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 604 KB Output is correct
2 Correct 14 ms 604 KB Output is correct
3 Correct 17 ms 604 KB Output is correct
4 Correct 10 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 11 ms 604 KB Output is correct
2 Correct 14 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 16 ms 604 KB Output is correct
2 Correct 14 ms 632 KB Output is correct
3 Correct 19 ms 604 KB Output is correct
4 Correct 11 ms 604 KB Output is correct
5 Correct 12 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 217 ms 4776 KB Output is correct
2 Correct 382 ms 5084 KB Output is correct
3 Correct 239 ms 3672 KB Output is correct
4 Correct 177 ms 5936 KB Output is correct
5 Correct 135 ms 3332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 221 ms 4948 KB Output is correct
2 Correct 197 ms 4624 KB Output is correct
3 Correct 205 ms 4928 KB Output is correct
4 Correct 197 ms 6116 KB Output is correct
5 Correct 188 ms 6588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 337 ms 5200 KB Output is correct
2 Correct 402 ms 5004 KB Output is correct
3 Correct 471 ms 6024 KB Output is correct
4 Correct 198 ms 7456 KB Output is correct
5 Correct 253 ms 6088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 444 ms 5536 KB Output is correct
2 Correct 516 ms 5528 KB Output is correct
3 Correct 610 ms 6552 KB Output is correct
4 Correct 201 ms 7500 KB Output is correct
5 Correct 256 ms 6776 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 361 ms 5552 KB Output is correct
2 Correct 511 ms 5544 KB Output is correct
3 Correct 598 ms 6580 KB Output is correct
4 Correct 218 ms 7596 KB Output is correct
5 Correct 257 ms 6900 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 24224 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 24244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 35640 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 35544 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1101 ms 38696 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1097 ms 38808 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 41892 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1079 ms 41968 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 48164 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1073 ms 48188 KB Time limit exceeded
2 Halted 0 ms 0 KB -