Submission #817155

# Submission time Handle Problem Language Result Execution time Memory
817155 2023-08-09T09:54:13 Z MisterReaper Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 31632 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 = 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 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 Incorrect 3 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 4 ms 468 KB Output is correct
4 Incorrect 8 ms 492 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 86 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 101 ms 2772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 51 ms 3068 KB Output is correct
2 Correct 48 ms 2900 KB Output is correct
3 Correct 63 ms 2900 KB Output is correct
4 Incorrect 167 ms 3416 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 3444 KB Output is correct
2 Correct 63 ms 3444 KB Output is correct
3 Correct 73 ms 3436 KB Output is correct
4 Incorrect 158 ms 3440 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 3440 KB Output is correct
2 Correct 60 ms 3532 KB Output is correct
3 Correct 73 ms 3440 KB Output is correct
4 Incorrect 162 ms 3440 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 278 ms 15956 KB Output is correct
2 Correct 303 ms 15968 KB Output is correct
3 Correct 289 ms 15964 KB Output is correct
4 Incorrect 806 ms 15960 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 302 ms 15964 KB Output is correct
2 Incorrect 560 ms 15960 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 345 ms 19092 KB Output is correct
2 Correct 358 ms 19068 KB Output is correct
3 Correct 366 ms 19092 KB Output is correct
4 Execution timed out 1027 ms 19104 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 361 ms 19096 KB Output is correct
2 Incorrect 718 ms 19100 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 389 ms 22228 KB Output is correct
2 Correct 435 ms 22228 KB Output is correct
3 Correct 411 ms 22228 KB Output is correct
4 Execution timed out 1078 ms 22148 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 456 ms 22236 KB Output is correct
2 Incorrect 877 ms 22228 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 458 ms 25300 KB Output is correct
2 Correct 511 ms 25360 KB Output is correct
3 Correct 484 ms 25360 KB Output is correct
4 Execution timed out 1090 ms 25300 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 487 ms 25360 KB Output is correct
2 Incorrect 999 ms 25368 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 592 ms 31572 KB Output is correct
2 Correct 603 ms 31620 KB Output is correct
3 Correct 599 ms 31628 KB Output is correct
4 Execution timed out 1089 ms 31628 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 632 ms 31632 KB Output is correct
2 Execution timed out 1073 ms 31572 KB Time limit exceeded
3 Halted 0 ms 0 KB -