Submission #639196

# Submission time Handle Problem Language Result Execution time Memory
639196 2022-09-09T00:26:17 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 16016 KB
#include<bits/stdc++.h>
#define int long long
using namespace std ;

const int maxn = 2e6 + 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 + 1e-9) f = max(f, fim) ;
    }

    return (f + 1e-9 >= 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, best ;
    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(5) << fim << "\n" ;
    //printf("%.3lf\n", best) ;

}

Compilation message

mobile.cpp: In function 'int32_t main()':
mobile.cpp:32:37: warning: variable 'best' set but not used [-Wunused-but-set-variable]
   32 |     double ini = 0, fim = inf, mid, 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 1 ms 316 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 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 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 392 KB Output is correct
2 Correct 6 ms 468 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 396 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 364 KB Output is correct
3 Correct 4 ms 380 KB Output is correct
4 Correct 7 ms 396 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 1364 KB Output is correct
2 Correct 82 ms 1468 KB Output is correct
3 Correct 51 ms 1136 KB Output is correct
4 Correct 104 ms 1368 KB Output is correct
5 Correct 40 ms 1108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1496 KB Output is correct
2 Correct 83 ms 1400 KB Output is correct
3 Correct 100 ms 1448 KB Output is correct
4 Correct 102 ms 1536 KB Output is correct
5 Correct 120 ms 1764 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 1608 KB Output is correct
2 Correct 91 ms 1472 KB Output is correct
3 Correct 81 ms 1504 KB Output is correct
4 Correct 153 ms 1840 KB Output is correct
5 Correct 91 ms 1592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 1860 KB Output is correct
2 Correct 107 ms 1764 KB Output is correct
3 Correct 91 ms 1816 KB Output is correct
4 Correct 152 ms 1836 KB Output is correct
5 Correct 116 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 1860 KB Output is correct
2 Correct 108 ms 1912 KB Output is correct
3 Correct 92 ms 1780 KB Output is correct
4 Correct 152 ms 1852 KB Output is correct
5 Correct 117 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 423 ms 8180 KB Output is correct
2 Correct 561 ms 8124 KB Output is correct
3 Correct 534 ms 8116 KB Output is correct
4 Correct 742 ms 8316 KB Output is correct
5 Correct 614 ms 8120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 575 ms 8268 KB Output is correct
2 Correct 560 ms 8052 KB Output is correct
3 Correct 475 ms 8216 KB Output is correct
4 Correct 735 ms 8132 KB Output is correct
5 Correct 642 ms 8244 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 519 ms 9692 KB Output is correct
2 Correct 662 ms 9880 KB Output is correct
3 Correct 647 ms 9584 KB Output is correct
4 Correct 923 ms 9872 KB Output is correct
5 Correct 712 ms 9692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 692 ms 9696 KB Output is correct
2 Correct 662 ms 9712 KB Output is correct
3 Correct 561 ms 9752 KB Output is correct
4 Correct 915 ms 9812 KB Output is correct
5 Correct 749 ms 9728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 602 ms 11192 KB Output is correct
2 Correct 808 ms 11136 KB Output is correct
3 Correct 753 ms 11288 KB Output is correct
4 Execution timed out 1056 ms 11264 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 831 ms 11148 KB Output is correct
2 Correct 776 ms 11200 KB Output is correct
3 Correct 675 ms 11152 KB Output is correct
4 Execution timed out 1088 ms 11228 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 683 ms 12748 KB Output is correct
2 Correct 885 ms 12844 KB Output is correct
3 Correct 857 ms 12876 KB Output is correct
4 Execution timed out 1093 ms 13004 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 938 ms 12784 KB Output is correct
2 Correct 882 ms 12764 KB Output is correct
3 Correct 767 ms 12840 KB Output is correct
4 Execution timed out 1090 ms 12692 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 845 ms 15968 KB Output is correct
2 Execution timed out 1097 ms 15904 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1098 ms 16016 KB Time limit exceeded
2 Halted 0 ms 0 KB -