답안 #639189

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639189 2022-09-08T23:45:08 Z Pietra Mobile (BOI12_mobile) C++14
0 / 100
396 ms 16016 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]) return 0 ;
        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(){

    scanf("%lf%lf", &n, &l) ;

    for(int i = 1 ; i <= n ; i++) scanf("%lf%lf", &x[i], &y[i]) ;

    double ini = 0, fim = inf, mid ;
    int it = 45 ;

    while(it--){
        mid = (ini + fim)/2 ;
       // printf("%.3lf\n", mid) ;
        if(check(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:28:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |     scanf("%lf%lf", &n, &l) ;
      |     ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:30:40: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     for(int i = 1 ; i <= n ; i++) scanf("%lf%lf", &x[i], &y[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Incorrect 2 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 28 ms 1388 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 29 ms 1444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1632 KB Output is correct
2 Correct 43 ms 1516 KB Output is correct
3 Incorrect 39 ms 1512 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1868 KB Output is correct
2 Correct 38 ms 1772 KB Output is correct
3 Incorrect 33 ms 1864 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 1864 KB Output is correct
2 Correct 39 ms 1872 KB Output is correct
3 Incorrect 31 ms 1836 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 168 ms 8232 KB Output is correct
2 Correct 194 ms 8016 KB Output is correct
3 Correct 192 ms 8128 KB Output is correct
4 Incorrect 193 ms 8012 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 196 ms 8160 KB Output is correct
2 Incorrect 165 ms 8196 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 205 ms 9608 KB Output is correct
2 Correct 239 ms 9672 KB Output is correct
3 Correct 225 ms 9628 KB Output is correct
4 Incorrect 264 ms 9680 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 231 ms 9660 KB Output is correct
2 Incorrect 197 ms 9692 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 237 ms 11176 KB Output is correct
2 Correct 271 ms 11252 KB Output is correct
3 Correct 266 ms 11252 KB Output is correct
4 Incorrect 270 ms 11236 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 270 ms 11200 KB Output is correct
2 Incorrect 237 ms 11212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 272 ms 12904 KB Output is correct
2 Correct 301 ms 12816 KB Output is correct
3 Correct 304 ms 12736 KB Output is correct
4 Incorrect 317 ms 12748 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 302 ms 12696 KB Output is correct
2 Incorrect 271 ms 12916 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 340 ms 15912 KB Output is correct
2 Correct 382 ms 15932 KB Output is correct
3 Correct 370 ms 16016 KB Output is correct
4 Incorrect 396 ms 15932 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 390 ms 15932 KB Output is correct
2 Incorrect 332 ms 15840 KB Output isn't correct
3 Halted 0 ms 0 KB -