Submission #639191

# Submission time Handle Problem Language Result Execution time Memory
639191 2022-09-08T23:48:54 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 16012 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(5) << 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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 4 ms 380 KB Output is correct
4 Correct 6 ms 392 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 4 ms 340 KB Output is correct
4 Correct 7 ms 392 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 7 ms 340 KB Output is correct
5 Correct 5 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 1460 KB Output is correct
2 Correct 81 ms 1476 KB Output is correct
3 Correct 50 ms 1100 KB Output is correct
4 Correct 101 ms 1472 KB Output is correct
5 Correct 41 ms 1084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 1476 KB Output is correct
2 Correct 77 ms 1396 KB Output is correct
3 Correct 96 ms 1572 KB Output is correct
4 Correct 100 ms 1480 KB Output is correct
5 Correct 119 ms 1620 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 1640 KB Output is correct
2 Correct 89 ms 1592 KB Output is correct
3 Correct 80 ms 1540 KB Output is correct
4 Correct 149 ms 1776 KB Output is correct
5 Correct 94 ms 1868 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 1780 KB Output is correct
2 Correct 106 ms 1856 KB Output is correct
3 Correct 93 ms 1868 KB Output is correct
4 Correct 152 ms 1860 KB Output is correct
5 Correct 118 ms 1852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 112 ms 1864 KB Output is correct
2 Correct 104 ms 1768 KB Output is correct
3 Correct 87 ms 1808 KB Output is correct
4 Correct 149 ms 1832 KB Output is correct
5 Correct 115 ms 1848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 408 ms 8088 KB Output is correct
2 Correct 547 ms 8220 KB Output is correct
3 Correct 530 ms 8116 KB Output is correct
4 Correct 752 ms 8016 KB Output is correct
5 Correct 599 ms 8072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 565 ms 8256 KB Output is correct
2 Correct 549 ms 8116 KB Output is correct
3 Correct 456 ms 8120 KB Output is correct
4 Correct 729 ms 8080 KB Output is correct
5 Correct 622 ms 8124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 487 ms 9644 KB Output is correct
2 Correct 655 ms 9692 KB Output is correct
3 Correct 638 ms 9728 KB Output is correct
4 Correct 893 ms 9784 KB Output is correct
5 Correct 698 ms 9692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 682 ms 9700 KB Output is correct
2 Correct 647 ms 9688 KB Output is correct
3 Correct 541 ms 9632 KB Output is correct
4 Correct 888 ms 9808 KB Output is correct
5 Correct 795 ms 9692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 583 ms 11252 KB Output is correct
2 Correct 767 ms 11256 KB Output is correct
3 Correct 740 ms 11284 KB Output is correct
4 Execution timed out 1020 ms 11264 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 793 ms 11156 KB Output is correct
2 Correct 747 ms 11236 KB Output is correct
3 Correct 652 ms 11240 KB Output is correct
4 Execution timed out 1045 ms 11372 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 704 ms 12920 KB Output is correct
2 Correct 872 ms 12792 KB Output is correct
3 Correct 841 ms 12856 KB Output is correct
4 Execution timed out 1086 ms 12848 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 926 ms 12796 KB Output is correct
2 Correct 864 ms 12932 KB Output is correct
3 Correct 740 ms 12932 KB Output is correct
4 Execution timed out 1093 ms 12780 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 832 ms 15928 KB Output is correct
2 Execution timed out 1080 ms 16012 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1091 ms 15948 KB Time limit exceeded
2 Halted 0 ms 0 KB -