Submission #639190

# Submission time Handle Problem Language Result Execution time Memory
639190 2022-09-08T23:46:35 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 15980 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 ;
    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) ;

}
# 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 0 ms 212 KB Output is correct
4 Correct 0 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 0 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 3 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 5 ms 292 KB Output is correct
2 Correct 6 ms 348 KB Output is correct
3 Correct 4 ms 388 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
# Verdict Execution time Memory 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 6 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 1612 KB Output is correct
2 Correct 84 ms 1408 KB Output is correct
3 Correct 49 ms 1028 KB Output is correct
4 Correct 99 ms 1440 KB Output is correct
5 Correct 40 ms 1080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1516 KB Output is correct
2 Correct 79 ms 1312 KB Output is correct
3 Correct 94 ms 1484 KB Output is correct
4 Correct 103 ms 1568 KB Output is correct
5 Correct 120 ms 1652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1600 KB Output is correct
2 Correct 86 ms 1564 KB Output is correct
3 Correct 77 ms 1612 KB Output is correct
4 Correct 149 ms 1844 KB Output is correct
5 Correct 91 ms 1708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 1836 KB Output is correct
2 Correct 105 ms 1868 KB Output is correct
3 Correct 89 ms 1748 KB Output is correct
4 Correct 151 ms 1892 KB Output is correct
5 Correct 115 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 108 ms 1980 KB Output is correct
2 Correct 106 ms 1852 KB Output is correct
3 Correct 88 ms 1740 KB Output is correct
4 Correct 151 ms 1968 KB Output is correct
5 Correct 116 ms 1764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 416 ms 8052 KB Output is correct
2 Correct 541 ms 8084 KB Output is correct
3 Correct 536 ms 8172 KB Output is correct
4 Correct 751 ms 8072 KB Output is correct
5 Correct 594 ms 8264 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 570 ms 8124 KB Output is correct
2 Correct 546 ms 8160 KB Output is correct
3 Correct 459 ms 8128 KB Output is correct
4 Correct 728 ms 8268 KB Output is correct
5 Correct 617 ms 8008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 501 ms 9812 KB Output is correct
2 Correct 660 ms 9576 KB Output is correct
3 Correct 631 ms 9704 KB Output is correct
4 Correct 893 ms 9852 KB Output is correct
5 Correct 711 ms 9636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 683 ms 9616 KB Output is correct
2 Correct 641 ms 9680 KB Output is correct
3 Correct 552 ms 9804 KB Output is correct
4 Correct 881 ms 9784 KB Output is correct
5 Correct 734 ms 9804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 584 ms 11164 KB Output is correct
2 Correct 757 ms 11212 KB Output is correct
3 Correct 727 ms 11148 KB Output is correct
4 Execution timed out 1041 ms 11160 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 782 ms 11176 KB Output is correct
2 Correct 748 ms 11188 KB Output is correct
3 Correct 653 ms 11340 KB Output is correct
4 Execution timed out 1006 ms 11336 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 657 ms 12864 KB Output is correct
2 Correct 888 ms 12824 KB Output is correct
3 Correct 857 ms 12812 KB Output is correct
4 Execution timed out 1095 ms 12748 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 914 ms 12936 KB Output is correct
2 Correct 849 ms 12840 KB Output is correct
3 Correct 742 ms 12844 KB Output is correct
4 Execution timed out 1093 ms 12700 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 824 ms 15980 KB Output is correct
2 Execution timed out 1092 ms 15920 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1090 ms 15884 KB Time limit exceeded
2 Halted 0 ms 0 KB -