Submission #817163

# Submission time Handle Problem Language Result Execution time Memory
817163 2023-08-09T10:00:53 Z MisterReaper Mobile (BOI12_mobile) C++17
70 / 100
1000 ms 35536 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-9)
    {
        debug(l, r);
        double mid = (l + r) / 2;
        if(check(mid))
        {
            r = mid;
            res = mid;
        }
        else l = mid;
    }

    cout << fixed << setprecision(10) << res;
    cerr << fixed << setprecision(10) << 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 1 ms 212 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 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 484 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Correct 10 ms 532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 468 KB Output is correct
2 Correct 3 ms 468 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Correct 9 ms 556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 468 KB Output is correct
2 Correct 5 ms 468 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Correct 8 ms 488 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 2652 KB Output is correct
2 Correct 46 ms 3788 KB Output is correct
3 Correct 42 ms 2604 KB Output is correct
4 Correct 120 ms 3836 KB Output is correct
5 Correct 59 ms 2268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 2772 KB Output is correct
2 Correct 96 ms 3324 KB Output is correct
3 Correct 111 ms 3876 KB Output is correct
4 Correct 115 ms 3984 KB Output is correct
5 Correct 130 ms 4436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 3028 KB Output is correct
2 Correct 50 ms 2900 KB Output is correct
3 Correct 66 ms 2960 KB Output is correct
4 Correct 163 ms 3420 KB Output is correct
5 Correct 115 ms 4020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3412 KB Output is correct
2 Correct 62 ms 3440 KB Output is correct
3 Correct 75 ms 3436 KB Output is correct
4 Correct 159 ms 3412 KB Output is correct
5 Correct 163 ms 4704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 3452 KB Output is correct
2 Correct 60 ms 3412 KB Output is correct
3 Correct 77 ms 3444 KB Output is correct
4 Correct 159 ms 3440 KB Output is correct
5 Correct 137 ms 4684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 16084 KB Output is correct
2 Correct 324 ms 15956 KB Output is correct
3 Correct 311 ms 15968 KB Output is correct
4 Correct 821 ms 15968 KB Output is correct
5 Correct 705 ms 22804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 317 ms 15964 KB Output is correct
2 Correct 639 ms 15964 KB Output is correct
3 Correct 405 ms 21732 KB Output is correct
4 Correct 787 ms 25316 KB Output is correct
5 Correct 755 ms 23280 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 363 ms 19096 KB Output is correct
2 Correct 373 ms 19104 KB Output is correct
3 Correct 388 ms 19100 KB Output is correct
4 Correct 980 ms 19148 KB Output is correct
5 Correct 850 ms 27092 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 371 ms 19092 KB Output is correct
2 Correct 782 ms 19096 KB Output is correct
3 Correct 520 ms 25940 KB Output is correct
4 Correct 981 ms 30836 KB Output is correct
5 Correct 873 ms 27824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 426 ms 22228 KB Output is correct
2 Correct 448 ms 22228 KB Output is correct
3 Correct 437 ms 22228 KB Output is correct
4 Execution timed out 1087 ms 22228 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 462 ms 22232 KB Output is correct
2 Correct 913 ms 22232 KB Output is correct
3 Correct 568 ms 30540 KB Output is correct
4 Execution timed out 1063 ms 35536 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 485 ms 25360 KB Output is correct
2 Correct 501 ms 25356 KB Output is correct
3 Correct 504 ms 25360 KB Output is correct
4 Execution timed out 1083 ms 25300 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 512 ms 25356 KB Output is correct
2 Execution timed out 1076 ms 25352 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 611 ms 31620 KB Output is correct
2 Correct 660 ms 31556 KB Output is correct
3 Correct 643 ms 31620 KB Output is correct
4 Execution timed out 1080 ms 31572 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 628 ms 31572 KB Output is correct
2 Execution timed out 1089 ms 31572 KB Time limit exceeded
3 Halted 0 ms 0 KB -