Submission #817154

# Submission time Handle Problem Language Result Execution time Memory
817154 2023-08-09T09:52:42 Z MisterReaper Mobile (BOI12_mobile) C++17
0 / 100
1000 ms 15956 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 <int, int> 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 (m <= cur);
    };

    double l = 0, r = 1.5e9, 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 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 360 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 2 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 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 Incorrect 8 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 1472 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 77 ms 1520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 1620 KB Output is correct
2 Correct 38 ms 1588 KB Output is correct
3 Correct 49 ms 1620 KB Output is correct
4 Incorrect 135 ms 1848 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 1876 KB Output is correct
2 Correct 40 ms 1876 KB Output is correct
3 Correct 62 ms 1876 KB Output is correct
4 Incorrect 156 ms 1876 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 32 ms 1880 KB Output is correct
2 Correct 42 ms 1876 KB Output is correct
3 Correct 56 ms 1876 KB Output is correct
4 Incorrect 148 ms 1856 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 147 ms 8124 KB Output is correct
2 Correct 161 ms 8124 KB Output is correct
3 Correct 165 ms 8136 KB Output is correct
4 Incorrect 662 ms 8128 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 167 ms 8120 KB Output is correct
2 Incorrect 443 ms 8124 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 173 ms 9684 KB Output is correct
2 Correct 192 ms 9684 KB Output is correct
3 Correct 187 ms 9688 KB Output is correct
4 Incorrect 868 ms 9688 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 193 ms 9688 KB Output is correct
2 Incorrect 589 ms 9684 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 200 ms 11256 KB Output is correct
2 Correct 223 ms 11252 KB Output is correct
3 Correct 220 ms 11252 KB Output is correct
4 Execution timed out 1016 ms 11252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 232 ms 11252 KB Output is correct
2 Incorrect 682 ms 11248 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 263 ms 12816 KB Output is correct
2 Correct 262 ms 12824 KB Output is correct
3 Correct 254 ms 12820 KB Output is correct
4 Execution timed out 1004 ms 12824 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 261 ms 12820 KB Output is correct
2 Incorrect 815 ms 12816 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 410 ms 15956 KB Output is correct
2 Correct 326 ms 15904 KB Output is correct
3 Correct 342 ms 15952 KB Output is correct
4 Execution timed out 1064 ms 15956 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 341 ms 15956 KB Output is correct
2 Incorrect 949 ms 15956 KB Output isn't correct
3 Halted 0 ms 0 KB -