Submission #550794

# Submission time Handle Problem Language Result Execution time Memory
550794 2022-04-19T08:25:59 Z CyberSleeper Mobile (BOI12_mobile) C++14
65 / 100
1000 ms 35844 KB
#include <bits/stdc++.h>
#define fastio      ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define debug(x)    cout << "Line " << __LINE__ << ", " << #x << " is " << x << endl
#define all(x)      x.begin(), x.end()
#define fi          first
#define se          second
#define mp          make_pair
#define pb          push_back
#define ll          long long
#define ull         unsigned long long
#define pll         pair<ll, ll>
#define pii         pair<int, int>
#define pld         pair<ld, ld>
#define ld          long double
#define nl          endl
#define tb          '\t'
#define sp          ' '
#define sqr(x)      (x)*(x)
#define arr3        array<int, 3>
using namespace std;
 
const int MX=1000005, MOD=1000000007, BLOCK=160, INF=2e9+7, LG=62;
const ll INFF=1000000000000000007;
const ld ERR=1e-3, pi=3.14159265358979323846;

ll N;
ld L;
pld A[MX];

bool valid(ld x){
    ld best=0;
    for(int i=1; i<=N; i++){
        ld dist=sqrt(x*x - A[i].se*A[i].se);
        ld le=A[i].fi-dist, ri=A[i].fi+dist;
        if(le<=best)
            best=max(best, ri);
    }
    return (L<=best);
}

int main(){
    fastio;
    cin >> N >> L;
    for(int i=1; i<=N; i++){
        cin >> A[i].fi >> A[i].se;
    }
    ld le=0, ri=1e10, mi, ans;
    while(le+ERR<=ri){
        mi=(le+ri)/2;
        if(valid(mi)){
            ri=mi;
            ans=mi;
        }else
            le=mi;
    }
    cout << fixed << setprecision(3) << ans << nl;
}
# 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 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 340 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 348 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 4 ms 468 KB Output is correct
4 Correct 6 ms 568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 14 ms 560 KB Output is correct
3 Correct 4 ms 472 KB Output is correct
4 Correct 6 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 468 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 4 ms 472 KB Output is correct
4 Correct 7 ms 468 KB Output is correct
5 Correct 6 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 3456 KB Output is correct
2 Correct 69 ms 3800 KB Output is correct
3 Correct 42 ms 2532 KB Output is correct
4 Correct 91 ms 3852 KB Output is correct
5 Correct 41 ms 2168 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 3404 KB Output is correct
2 Correct 113 ms 3336 KB Output is correct
3 Correct 92 ms 3888 KB Output is correct
4 Correct 110 ms 4004 KB Output is correct
5 Correct 110 ms 4408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 3712 KB Output is correct
2 Correct 75 ms 4056 KB Output is correct
3 Correct 93 ms 3932 KB Output is correct
4 Correct 143 ms 5092 KB Output is correct
5 Correct 89 ms 3940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 98 ms 4924 KB Output is correct
2 Correct 81 ms 4920 KB Output is correct
3 Correct 73 ms 4400 KB Output is correct
4 Correct 153 ms 5116 KB Output is correct
5 Correct 132 ms 4816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 107 ms 4880 KB Output is correct
2 Correct 83 ms 4860 KB Output is correct
3 Correct 102 ms 4492 KB Output is correct
4 Correct 139 ms 5020 KB Output is correct
5 Correct 130 ms 4636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 464 ms 17524 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 464 ms 17676 KB Output is correct
2 Correct 597 ms 18908 KB Output is correct
3 Correct 459 ms 17888 KB Output is correct
4 Correct 685 ms 17992 KB Output is correct
5 Correct 623 ms 19164 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 468 ms 20768 KB Output is correct
2 Correct 541 ms 21204 KB Output is correct
3 Correct 505 ms 21612 KB Output is correct
4 Correct 911 ms 22564 KB Output is correct
5 Correct 687 ms 21968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 496 ms 20572 KB Output is correct
2 Correct 733 ms 21840 KB Output is correct
3 Correct 591 ms 21968 KB Output is correct
4 Correct 956 ms 22348 KB Output is correct
5 Correct 775 ms 21368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 525 ms 24276 KB Output is correct
2 Correct 601 ms 24560 KB Output is correct
3 Correct 610 ms 23672 KB Output is correct
4 Execution timed out 1024 ms 25188 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 626 ms 25060 KB Output is correct
2 Correct 828 ms 24636 KB Output is correct
3 Correct 645 ms 24804 KB Output is correct
4 Execution timed out 1047 ms 24952 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 727 ms 27748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 701 ms 27932 KB Output is correct
2 Correct 986 ms 28084 KB Output is correct
3 Correct 742 ms 27200 KB Output is correct
4 Execution timed out 1091 ms 29080 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 780 ms 34192 KB Output is correct
2 Correct 929 ms 35772 KB Output is correct
3 Correct 902 ms 35844 KB Output is correct
4 Execution timed out 1068 ms 32352 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1093 ms 35628 KB Time limit exceeded
2 Halted 0 ms 0 KB -