Submission #817168

# Submission time Handle Problem Language Result Execution time Memory
817168 2023-08-09T10:02:27 Z MisterReaper Mobile (BOI12_mobile) C++17
80 / 100
1000 ms 50964 KB
// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double

#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
    #include "debug.h"
    #define OPEN freopen(".in", "r", stdin); freopen(".out", "w", stdout);
    #define TIME cerr << "\n" << fixed << setprecision(2) << 1000.0 * clock() / CLOCKS_PER_SEC << " milliseconds ";
#else
    #define debug(...) void(23)
    #define debugarr(...) void(23)
    #define OPEN void(0000)
    #define TIME void(232323233)
#endif

void solve()
{
    int n, m; cin >> n >> m;
    pair <double, double> arr[n];
    for(auto &i : arr) cin >> i.first >> i.second;

    auto check = [&](double mid) -> bool
    {
        double cur = 0;;
        for(auto &i : arr)
        {
            double delta = sqrtl(mid * mid - i.second * i.second);
            double nl = i.first - delta;
            if(nl <= cur) cur = max(cur, i.first + delta);
        }
        return ((double) m <= cur);
    };

    double l = 0, r = 1e10, res = 0;
    while((r - l) >= 1e-3)
    {
        debug(l, r);
        double mid = (l + r) / 2;
        if(check(mid))
        {
            r = mid;
            res = mid;
        }
        else l = mid;
    }

    cout << fixed << setprecision(6) << res;
    
    return;
}

int32_t main()
{
    OPEN;

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    while(t--)
    {
        solve();
    }

    TIME;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 324 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 488 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 456 KB Output is correct
4 Correct 5 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 468 KB Output is correct
4 Correct 7 ms 480 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 2644 KB Output is correct
2 Correct 40 ms 2772 KB Output is correct
3 Correct 34 ms 2132 KB Output is correct
4 Correct 86 ms 2792 KB Output is correct
5 Correct 40 ms 2004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 67 ms 2772 KB Output is correct
2 Correct 65 ms 2624 KB Output is correct
3 Correct 78 ms 2976 KB Output is correct
4 Correct 84 ms 2916 KB Output is correct
5 Correct 96 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 2964 KB Output is correct
2 Correct 42 ms 2900 KB Output is correct
3 Correct 56 ms 2956 KB Output is correct
4 Correct 120 ms 3420 KB Output is correct
5 Correct 79 ms 3156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 53 ms 3440 KB Output is correct
2 Correct 56 ms 3504 KB Output is correct
3 Correct 59 ms 3444 KB Output is correct
4 Correct 122 ms 3412 KB Output is correct
5 Correct 96 ms 3572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 3436 KB Output is correct
2 Correct 51 ms 3412 KB Output is correct
3 Correct 63 ms 3412 KB Output is correct
4 Correct 121 ms 3436 KB Output is correct
5 Correct 96 ms 3540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 259 ms 15968 KB Output is correct
2 Correct 272 ms 15964 KB Output is correct
3 Correct 271 ms 15968 KB Output is correct
4 Correct 597 ms 15960 KB Output is correct
5 Correct 500 ms 16092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 301 ms 15960 KB Output is correct
2 Correct 442 ms 15920 KB Output is correct
3 Correct 332 ms 16092 KB Output is correct
4 Correct 603 ms 16092 KB Output is correct
5 Correct 550 ms 16092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 320 ms 19096 KB Output is correct
2 Correct 332 ms 19096 KB Output is correct
3 Correct 368 ms 19100 KB Output is correct
4 Correct 729 ms 19100 KB Output is correct
5 Correct 593 ms 19232 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 342 ms 19096 KB Output is correct
2 Correct 526 ms 19100 KB Output is correct
3 Correct 393 ms 19232 KB Output is correct
4 Correct 733 ms 19220 KB Output is correct
5 Correct 622 ms 19224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 361 ms 22228 KB Output is correct
2 Correct 379 ms 22224 KB Output is correct
3 Correct 382 ms 22236 KB Output is correct
4 Correct 886 ms 22232 KB Output is correct
5 Correct 699 ms 31268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 385 ms 22232 KB Output is correct
2 Correct 678 ms 22228 KB Output is correct
3 Correct 454 ms 22352 KB Output is correct
4 Correct 838 ms 22360 KB Output is correct
5 Correct 729 ms 32368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 455 ms 25356 KB Output is correct
2 Correct 437 ms 25360 KB Output is correct
3 Correct 442 ms 25360 KB Output is correct
4 Execution timed out 1014 ms 25360 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 451 ms 25372 KB Output is correct
2 Correct 750 ms 25356 KB Output is correct
3 Correct 563 ms 34888 KB Output is correct
4 Execution timed out 1038 ms 40844 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 512 ms 31636 KB Output is correct
2 Correct 549 ms 31624 KB Output is correct
3 Correct 553 ms 31620 KB Output is correct
4 Execution timed out 1087 ms 31616 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 555 ms 31632 KB Output is correct
2 Correct 885 ms 31620 KB Output is correct
3 Correct 678 ms 43948 KB Output is correct
4 Execution timed out 1064 ms 50964 KB Time limit exceeded
5 Halted 0 ms 0 KB -