답안 #639188

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639188 2022-09-08T23:42:12 Z Pietra Mobile (BOI12_mobile) C++14
0 / 100
411 ms 16612 KB
#include<bits/stdc++.h>
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) ;

}

int 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, best = -1 ;
    int it = 45 ;

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

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

}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf("%lf%lf", &n, &l) ;
      |     ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:29:40: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     for(int i = 1 ; i <= n ; i++) scanf("%lf%lf", &x[i], &y[i]) ;
      |                                   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 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 4 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 2 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 31 ms 1500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 39 ms 1520 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 34 ms 1608 KB Output is correct
2 Correct 48 ms 1584 KB Output is correct
3 Incorrect 28 ms 1528 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 40 ms 1860 KB Output is correct
2 Correct 41 ms 1824 KB Output is correct
3 Incorrect 33 ms 1792 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 1788 KB Output is correct
2 Correct 39 ms 1876 KB Output is correct
3 Incorrect 33 ms 1848 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 176 ms 8124 KB Output is correct
2 Correct 192 ms 8076 KB Output is correct
3 Correct 192 ms 8012 KB Output is correct
4 Incorrect 198 ms 8108 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 205 ms 8836 KB Output is correct
2 Incorrect 169 ms 8312 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 212 ms 9628 KB Output is correct
2 Correct 229 ms 9692 KB Output is correct
3 Correct 234 ms 9720 KB Output is correct
4 Incorrect 238 ms 9620 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 242 ms 10448 KB Output is correct
2 Incorrect 205 ms 9656 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 246 ms 11228 KB Output is correct
2 Correct 280 ms 11220 KB Output is correct
3 Correct 267 ms 11184 KB Output is correct
4 Incorrect 286 ms 11224 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 284 ms 11920 KB Output is correct
2 Incorrect 238 ms 11212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 290 ms 13264 KB Output is correct
2 Correct 316 ms 12808 KB Output is correct
3 Correct 304 ms 12776 KB Output is correct
4 Incorrect 328 ms 12716 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 319 ms 13512 KB Output is correct
2 Incorrect 267 ms 12812 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 356 ms 16572 KB Output is correct
2 Correct 384 ms 15976 KB Output is correct
3 Correct 378 ms 15940 KB Output is correct
4 Incorrect 399 ms 15940 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 411 ms 16612 KB Output is correct
2 Incorrect 339 ms 16092 KB Output isn't correct
3 Halted 0 ms 0 KB -