답안 #639192

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639192 2022-09-08T23:56:10 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 15956 KB
#include<bits/stdc++.h>
#define int long long
using namespace std ;

const int maxn = 1e6 + 5 ;
const double inf = 2e9 ;

double n ;
double l, x[maxn], y[maxn] ;

bool check(double r){

    double f = 0 ;

    for(int i = 1 ; i <= n ; i++){
        if(r < y[i]) continue ;
        double dx = sqrt(((r*r) - (y[i]*y[i]))) ;
        double ini = x[i] - dx, fim = x[i] + dx ;
        if(ini <= f) f = max(f, fim) ;
    }

    return (f >= l) ;

}

int32_t main(){

    cin >> n >> l ;

    for(int i = 1 ; i <= n ; i++) cin >> x[i] >> y[i] ;

    double ini = 0, fim = inf, mid, best ;
    int it = 50 ;

    while(it--){
        mid = (ini + fim)/2 ;
       // printf("%.3lf\n", mid) ;
        if(check(mid)) best = mid, fim = mid ;
        else ini = mid ;
    }

    cout << fixed << setprecision(3) << fim << "\n" ;
    //printf("%.3lf\n", best) ;

}

Compilation message

mobile.cpp: In function 'int32_t main()':
mobile.cpp:32:37: warning: variable 'best' set but not used [-Wunused-but-set-variable]
   32 |     double ini = 0, fim = inf, mid, best ;
      |                                     ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 3 ms 340 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 352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 7 ms 388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 336 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 8 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 8 ms 384 KB Output is correct
3 Correct 5 ms 392 KB Output is correct
4 Correct 7 ms 372 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 80 ms 1464 KB Output is correct
2 Correct 86 ms 1468 KB Output is correct
3 Correct 56 ms 1108 KB Output is correct
4 Correct 104 ms 1556 KB Output is correct
5 Correct 43 ms 1084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 88 ms 1496 KB Output is correct
2 Correct 81 ms 1392 KB Output is correct
3 Correct 108 ms 1488 KB Output is correct
4 Correct 107 ms 1472 KB Output is correct
5 Correct 130 ms 1608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 71 ms 1648 KB Output is correct
2 Correct 88 ms 1676 KB Output is correct
3 Correct 83 ms 1588 KB Output is correct
4 Correct 157 ms 1748 KB Output is correct
5 Correct 104 ms 1624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 112 ms 1816 KB Output is correct
2 Correct 111 ms 1820 KB Output is correct
3 Correct 93 ms 1864 KB Output is correct
4 Correct 161 ms 1736 KB Output is correct
5 Correct 121 ms 1848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 1908 KB Output is correct
2 Correct 115 ms 1804 KB Output is correct
3 Correct 92 ms 1796 KB Output is correct
4 Correct 153 ms 1868 KB Output is correct
5 Correct 122 ms 1984 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 434 ms 8088 KB Output is correct
2 Correct 566 ms 8204 KB Output is correct
3 Correct 538 ms 8012 KB Output is correct
4 Correct 777 ms 8120 KB Output is correct
5 Correct 635 ms 8040 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 621 ms 8104 KB Output is correct
2 Correct 612 ms 8120 KB Output is correct
3 Correct 485 ms 8160 KB Output is correct
4 Correct 766 ms 8296 KB Output is correct
5 Correct 668 ms 8120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 495 ms 9640 KB Output is correct
2 Correct 680 ms 9692 KB Output is correct
3 Correct 642 ms 9804 KB Output is correct
4 Correct 939 ms 9836 KB Output is correct
5 Correct 739 ms 9800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 731 ms 9716 KB Output is correct
2 Correct 691 ms 9692 KB Output is correct
3 Correct 560 ms 9692 KB Output is correct
4 Correct 926 ms 9692 KB Output is correct
5 Correct 764 ms 9972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 613 ms 11348 KB Output is correct
2 Correct 793 ms 11272 KB Output is correct
3 Correct 822 ms 11136 KB Output is correct
4 Execution timed out 1069 ms 11256 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 794 ms 11328 KB Output is correct
2 Correct 758 ms 11400 KB Output is correct
3 Correct 662 ms 11248 KB Output is correct
4 Execution timed out 1034 ms 11288 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 663 ms 12748 KB Output is correct
2 Correct 879 ms 12880 KB Output is correct
3 Correct 863 ms 12708 KB Output is correct
4 Execution timed out 1080 ms 12804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 907 ms 12768 KB Output is correct
2 Correct 863 ms 12840 KB Output is correct
3 Correct 740 ms 12768 KB Output is correct
4 Execution timed out 1075 ms 12792 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 831 ms 15948 KB Output is correct
2 Execution timed out 1094 ms 15920 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1092 ms 15956 KB Time limit exceeded
2 Halted 0 ms 0 KB -