Submission #639209

# Submission time Handle Problem Language Result Execution time Memory
639209 2022-09-09T01:01:47 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 16040 KB
#include<bits/stdc++.h>
#define int long long
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) ;
}

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 ct = 45 ; 
    
    while(ct--){
        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 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 3 ms 340 KB Output is correct
2 Correct 2 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 388 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 6 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 5 ms 376 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 5 ms 340 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 5 ms 336 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 81 ms 1468 KB Output is correct
2 Correct 87 ms 1412 KB Output is correct
3 Correct 51 ms 1132 KB Output is correct
4 Correct 102 ms 1480 KB Output is correct
5 Correct 39 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 1492 KB Output is correct
2 Correct 77 ms 1392 KB Output is correct
3 Correct 94 ms 1604 KB Output is correct
4 Correct 114 ms 1436 KB Output is correct
5 Correct 120 ms 1584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1668 KB Output is correct
2 Correct 86 ms 1500 KB Output is correct
3 Correct 78 ms 1520 KB Output is correct
4 Correct 150 ms 1916 KB Output is correct
5 Correct 90 ms 1612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 1840 KB Output is correct
2 Correct 105 ms 1792 KB Output is correct
3 Correct 89 ms 1740 KB Output is correct
4 Correct 152 ms 1832 KB Output is correct
5 Correct 115 ms 1876 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 1868 KB Output is correct
2 Correct 107 ms 1864 KB Output is correct
3 Correct 100 ms 1848 KB Output is correct
4 Correct 149 ms 1864 KB Output is correct
5 Correct 119 ms 1828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 416 ms 8100 KB Output is correct
2 Correct 549 ms 8024 KB Output is correct
3 Correct 524 ms 8060 KB Output is correct
4 Correct 728 ms 8268 KB Output is correct
5 Correct 603 ms 8188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 570 ms 8048 KB Output is correct
2 Correct 559 ms 8124 KB Output is correct
3 Correct 468 ms 8096 KB Output is correct
4 Correct 715 ms 8124 KB Output is correct
5 Correct 617 ms 8096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 511 ms 9664 KB Output is correct
2 Correct 675 ms 9664 KB Output is correct
3 Correct 636 ms 9688 KB Output is correct
4 Correct 898 ms 9620 KB Output is correct
5 Correct 699 ms 9700 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 685 ms 9676 KB Output is correct
2 Correct 664 ms 9728 KB Output is correct
3 Correct 544 ms 9680 KB Output is correct
4 Correct 899 ms 9620 KB Output is correct
5 Correct 750 ms 9624 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 583 ms 11256 KB Output is correct
2 Correct 770 ms 11256 KB Output is correct
3 Correct 738 ms 11412 KB Output is correct
4 Execution timed out 1031 ms 11256 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 805 ms 11268 KB Output is correct
2 Correct 775 ms 11276 KB Output is correct
3 Correct 651 ms 11244 KB Output is correct
4 Execution timed out 1026 ms 11252 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 662 ms 12816 KB Output is correct
2 Correct 875 ms 12816 KB Output is correct
3 Correct 854 ms 12716 KB Output is correct
4 Execution timed out 1044 ms 12820 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 915 ms 12848 KB Output is correct
2 Correct 857 ms 12856 KB Output is correct
3 Correct 738 ms 12748 KB Output is correct
4 Execution timed out 1093 ms 12716 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 835 ms 16024 KB Output is correct
2 Execution timed out 1084 ms 16040 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1083 ms 15964 KB Time limit exceeded
2 Halted 0 ms 0 KB -