Submission #639211

# Submission time Handle Problem Language Result Execution time Memory
639211 2022-09-09T01:04:45 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 15980 KB
#include<bits/stdc++.h>
using namespace std ;

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

double n, 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) ;
}

int main(){

    cin >> n >> l ;

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

    double ini = 0, fim = inf, mid ;

    while(fim - ini > 1e-6){
        mid = (ini + fim)/2 ;
        if(check(mid)) fim = mid ;
        else ini = mid ;
    }

    cout << fixed << setprecision(6) << fim << "\n" ;

}
# 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 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 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 468 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 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 400 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
# Verdict Execution time Memory Grader output
1 Correct 6 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 5 ms 340 KB Output is correct
4 Correct 8 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 8 ms 392 KB Output is correct
5 Correct 5 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 84 ms 1356 KB Output is correct
2 Correct 83 ms 1392 KB Output is correct
3 Correct 60 ms 1136 KB Output is correct
4 Correct 109 ms 1488 KB Output is correct
5 Correct 42 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 1528 KB Output is correct
2 Correct 83 ms 1284 KB Output is correct
3 Correct 102 ms 1568 KB Output is correct
4 Correct 109 ms 1540 KB Output is correct
5 Correct 122 ms 1660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 1632 KB Output is correct
2 Correct 91 ms 1544 KB Output is correct
3 Correct 81 ms 1524 KB Output is correct
4 Correct 155 ms 1808 KB Output is correct
5 Correct 94 ms 1612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 119 ms 1876 KB Output is correct
2 Correct 108 ms 1784 KB Output is correct
3 Correct 91 ms 1740 KB Output is correct
4 Correct 157 ms 1848 KB Output is correct
5 Correct 119 ms 1860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 117 ms 1840 KB Output is correct
2 Correct 112 ms 1848 KB Output is correct
3 Correct 89 ms 1788 KB Output is correct
4 Correct 158 ms 1868 KB Output is correct
5 Correct 121 ms 1784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 432 ms 8140 KB Output is correct
2 Correct 556 ms 8152 KB Output is correct
3 Correct 549 ms 8124 KB Output is correct
4 Correct 774 ms 8312 KB Output is correct
5 Correct 633 ms 8124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 591 ms 8152 KB Output is correct
2 Correct 572 ms 8044 KB Output is correct
3 Correct 472 ms 8060 KB Output is correct
4 Correct 750 ms 8224 KB Output is correct
5 Correct 762 ms 8124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 523 ms 9700 KB Output is correct
2 Correct 700 ms 9696 KB Output is correct
3 Correct 654 ms 9816 KB Output is correct
4 Correct 932 ms 9904 KB Output is correct
5 Correct 747 ms 9764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 696 ms 9768 KB Output is correct
2 Correct 683 ms 9692 KB Output is correct
3 Correct 568 ms 9640 KB Output is correct
4 Correct 926 ms 9692 KB Output is correct
5 Correct 785 ms 9756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 614 ms 11188 KB Output is correct
2 Correct 781 ms 11236 KB Output is correct
3 Correct 761 ms 11296 KB Output is correct
4 Execution timed out 1094 ms 11420 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 819 ms 11232 KB Output is correct
2 Correct 778 ms 11332 KB Output is correct
3 Correct 679 ms 11196 KB Output is correct
4 Execution timed out 1068 ms 11172 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 704 ms 12840 KB Output is correct
2 Correct 919 ms 12964 KB Output is correct
3 Correct 858 ms 12880 KB Output is correct
4 Execution timed out 1087 ms 12804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 928 ms 12792 KB Output is correct
2 Correct 896 ms 12884 KB Output is correct
3 Correct 776 ms 12824 KB Output is correct
4 Execution timed out 1096 ms 12808 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 855 ms 15980 KB Output is correct
2 Execution timed out 1099 ms 15940 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1087 ms 15900 KB Time limit exceeded
2 Halted 0 ms 0 KB -