Submission #550800

# Submission time Handle Problem Language Result Execution time Memory
550800 2022-04-19T08:36:40 Z CyberSleeper Mobile (BOI12_mobile) C++14
90 / 100
412 ms 16060 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          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;

int N;
int L;
pll A[MX];

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;
        ld best=0;
        for(int i=1; i<=N; i++){
            ld dist=sqrt(mi*mi - A[i].se*A[i].se);
            ld lef=A[i].fi-dist, rig=A[i].fi+dist;
            if(lef<=best)
                best=max(best, rig);
        }
        if(L<=best){
            ri=mi;
            ans=mi;
        }else
            le=mi;
    }
    cout << fixed << setprecision(3) << ans << nl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 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 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# 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 2 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
# 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 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 31 ms 1492 KB Output is correct
2 Correct 22 ms 1400 KB Output is correct
3 Correct 14 ms 1124 KB Output is correct
4 Correct 27 ms 1512 KB Output is correct
5 Correct 15 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1492 KB Output is correct
2 Correct 25 ms 1364 KB Output is correct
3 Correct 29 ms 1592 KB Output is correct
4 Correct 34 ms 1548 KB Output is correct
5 Correct 32 ms 1636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1704 KB Output is correct
2 Correct 24 ms 1492 KB Output is correct
3 Correct 24 ms 1636 KB Output is correct
4 Correct 44 ms 1864 KB Output is correct
5 Correct 40 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 1872 KB Output is correct
2 Correct 32 ms 1884 KB Output is correct
3 Correct 26 ms 1876 KB Output is correct
4 Correct 40 ms 1872 KB Output is correct
5 Correct 41 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1876 KB Output is correct
2 Correct 35 ms 1872 KB Output is correct
3 Correct 32 ms 1880 KB Output is correct
4 Correct 43 ms 1888 KB Output is correct
5 Correct 32 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 122 ms 8112 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 161 ms 8140 KB Output is correct
2 Correct 235 ms 8136 KB Output is correct
3 Correct 134 ms 8132 KB Output is correct
4 Correct 203 ms 8072 KB Output is correct
5 Correct 184 ms 8144 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 145 ms 9708 KB Output is correct
2 Correct 197 ms 9680 KB Output is correct
3 Correct 196 ms 9676 KB Output is correct
4 Correct 235 ms 9748 KB Output is correct
5 Correct 215 ms 9652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 192 ms 9704 KB Output is correct
2 Correct 274 ms 9612 KB Output is correct
3 Correct 177 ms 9584 KB Output is correct
4 Correct 253 ms 9776 KB Output is correct
5 Correct 266 ms 9680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 178 ms 11212 KB Output is correct
2 Correct 230 ms 11332 KB Output is correct
3 Correct 211 ms 11212 KB Output is correct
4 Correct 265 ms 11264 KB Output is correct
5 Correct 253 ms 11272 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 244 ms 11224 KB Output is correct
2 Correct 289 ms 11340 KB Output is correct
3 Correct 211 ms 11268 KB Output is correct
4 Correct 295 ms 11268 KB Output is correct
5 Correct 303 ms 11268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 244 ms 12860 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 239 ms 12832 KB Output is correct
2 Correct 404 ms 12876 KB Output is correct
3 Correct 225 ms 12808 KB Output is correct
4 Correct 319 ms 12832 KB Output is correct
5 Correct 302 ms 12832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 244 ms 15956 KB Output is correct
2 Correct 349 ms 15956 KB Output is correct
3 Correct 285 ms 15948 KB Output is correct
4 Correct 407 ms 16032 KB Output is correct
5 Correct 347 ms 15956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 314 ms 15932 KB Output is correct
2 Correct 412 ms 15960 KB Output is correct
3 Correct 316 ms 16032 KB Output is correct
4 Correct 403 ms 15876 KB Output is correct
5 Correct 351 ms 16060 KB Output is correct