Submission #817140

# Submission time Handle Problem Language Result Execution time Memory
817140 2023-08-09T09:47:49 Z MisterReaper Mobile (BOI12_mobile) C++17
0 / 100
349 ms 16204 KB
// author: MisterReaper (Ahmet Alp Orakci)
#include <bits/stdc++.h>
using namespace std;
#define int long long

#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 = sqrt(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-3)
    {
        debug(l, r);
        double mid = l + (r - l) / 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 Incorrect 1 ms 304 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 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Incorrect 1 ms 264 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 352 KB Output is correct
2 Correct 2 ms 468 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Incorrect 2 ms 468 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 1484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 1748 KB Output is correct
2 Correct 20 ms 1724 KB Output is correct
3 Correct 20 ms 1764 KB Output is correct
4 Incorrect 33 ms 1980 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1916 KB Output is correct
2 Correct 24 ms 2004 KB Output is correct
3 Correct 32 ms 2004 KB Output is correct
4 Incorrect 37 ms 2004 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 25 ms 2004 KB Output is correct
2 Correct 25 ms 2004 KB Output is correct
3 Correct 27 ms 2004 KB Output is correct
4 Incorrect 33 ms 2008 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 123 ms 8252 KB Output is correct
2 Correct 122 ms 8248 KB Output is correct
3 Correct 121 ms 8248 KB Output is correct
4 Incorrect 165 ms 8268 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 125 ms 8248 KB Output is correct
2 Incorrect 177 ms 8256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 126 ms 9820 KB Output is correct
2 Correct 151 ms 9820 KB Output is correct
3 Correct 144 ms 9816 KB Output is correct
4 Incorrect 195 ms 9836 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 166 ms 9904 KB Output is correct
2 Incorrect 219 ms 9816 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 156 ms 11448 KB Output is correct
2 Correct 169 ms 11384 KB Output is correct
3 Correct 166 ms 11384 KB Output is correct
4 Incorrect 235 ms 11272 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 186 ms 11384 KB Output is correct
2 Incorrect 259 ms 11380 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 172 ms 12884 KB Output is correct
2 Correct 208 ms 12944 KB Output is correct
3 Correct 202 ms 13000 KB Output is correct
4 Incorrect 258 ms 12884 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 196 ms 12944 KB Output is correct
2 Incorrect 291 ms 12948 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 215 ms 16084 KB Output is correct
2 Correct 241 ms 16080 KB Output is correct
3 Correct 236 ms 16204 KB Output is correct
4 Incorrect 323 ms 15956 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 263 ms 15948 KB Output is correct
2 Incorrect 349 ms 16076 KB Output isn't correct
3 Halted 0 ms 0 KB -