답안 #550797

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
550797 2022-04-19T08:28:20 Z CyberSleeper Mobile (BOI12_mobile) C++14
90 / 100
720 ms 29492 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;
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;
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 328 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 336 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 336 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 340 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 408 KB Output is correct
4 Correct 4 ms 404 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 444 KB Output is correct
2 Correct 4 ms 468 KB Output is correct
3 Correct 3 ms 380 KB Output is correct
4 Correct 4 ms 468 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 50 ms 2044 KB Output is correct
2 Correct 50 ms 2256 KB Output is correct
3 Correct 32 ms 1772 KB Output is correct
4 Correct 52 ms 2040 KB Output is correct
5 Correct 26 ms 1412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 43 ms 2120 KB Output is correct
2 Correct 41 ms 1996 KB Output is correct
3 Correct 60 ms 2108 KB Output is correct
4 Correct 69 ms 2108 KB Output is correct
5 Correct 61 ms 2252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 44 ms 2288 KB Output is correct
2 Correct 48 ms 2124 KB Output is correct
3 Correct 46 ms 2252 KB Output is correct
4 Correct 76 ms 2756 KB Output is correct
5 Correct 51 ms 2260 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 64 ms 2432 KB Output is correct
2 Correct 72 ms 2392 KB Output is correct
3 Correct 62 ms 2444 KB Output is correct
4 Correct 80 ms 2680 KB Output is correct
5 Correct 62 ms 2604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 61 ms 2512 KB Output is correct
2 Correct 61 ms 2404 KB Output is correct
3 Correct 56 ms 2476 KB Output is correct
4 Correct 75 ms 2704 KB Output is correct
5 Correct 65 ms 2488 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 265 ms 9356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 318 ms 9412 KB Output is correct
2 Correct 377 ms 9524 KB Output is correct
3 Correct 260 ms 9412 KB Output is correct
4 Correct 362 ms 9308 KB Output is correct
5 Correct 313 ms 9388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 312 ms 11008 KB Output is correct
2 Correct 382 ms 10920 KB Output is correct
3 Correct 359 ms 10956 KB Output is correct
4 Correct 441 ms 11624 KB Output is correct
5 Correct 394 ms 10980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 380 ms 11032 KB Output is correct
2 Correct 469 ms 10980 KB Output is correct
3 Correct 319 ms 10904 KB Output is correct
4 Correct 440 ms 11596 KB Output is correct
5 Correct 377 ms 10936 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 12544 KB Output is correct
2 Correct 430 ms 12644 KB Output is correct
3 Correct 414 ms 12600 KB Output is correct
4 Correct 494 ms 13172 KB Output is correct
5 Correct 444 ms 13656 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 444 ms 13276 KB Output is correct
2 Correct 471 ms 12672 KB Output is correct
3 Correct 400 ms 12928 KB Output is correct
4 Correct 490 ms 13204 KB Output is correct
5 Correct 444 ms 13456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 423 ms 14048 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 499 ms 14704 KB Output is correct
2 Correct 563 ms 14284 KB Output is correct
3 Correct 437 ms 13332 KB Output is correct
4 Correct 578 ms 13052 KB Output is correct
5 Correct 559 ms 22932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 533 ms 15952 KB Output is correct
2 Correct 601 ms 15956 KB Output is correct
3 Correct 595 ms 15996 KB Output is correct
4 Correct 720 ms 16116 KB Output is correct
5 Correct 616 ms 29492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 15972 KB Output is correct
2 Correct 690 ms 20176 KB Output is correct
3 Correct 561 ms 24348 KB Output is correct
4 Correct 717 ms 16540 KB Output is correct
5 Correct 638 ms 23796 KB Output is correct