Submission #639195

# Submission time Handle Problem Language Result Execution time Memory
639195 2022-09-09T00:05:32 Z Pietra Mobile (BOI12_mobile) C++14
70 / 100
1000 ms 15956 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) 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, 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(4) << 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 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 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 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 8 ms 324 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 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 404 KB Output is correct
2 Correct 6 ms 340 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 6 ms 340 KB Output is correct
2 Correct 5 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 6 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 72 ms 1456 KB Output is correct
2 Correct 88 ms 1428 KB Output is correct
3 Correct 54 ms 1100 KB Output is correct
4 Correct 98 ms 1408 KB Output is correct
5 Correct 39 ms 1008 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 70 ms 1500 KB Output is correct
2 Correct 83 ms 1396 KB Output is correct
3 Correct 95 ms 1568 KB Output is correct
4 Correct 103 ms 1544 KB Output is correct
5 Correct 126 ms 1652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 79 ms 1576 KB Output is correct
2 Correct 87 ms 1500 KB Output is correct
3 Correct 78 ms 1640 KB Output is correct
4 Correct 158 ms 1812 KB Output is correct
5 Correct 99 ms 1584 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 1872 KB Output is correct
2 Correct 105 ms 1864 KB Output is correct
3 Correct 90 ms 1740 KB Output is correct
4 Correct 154 ms 1860 KB Output is correct
5 Correct 128 ms 1840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 120 ms 1824 KB Output is correct
2 Correct 106 ms 1764 KB Output is correct
3 Correct 89 ms 1856 KB Output is correct
4 Correct 153 ms 1868 KB Output is correct
5 Correct 115 ms 1792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 423 ms 8052 KB Output is correct
2 Correct 572 ms 8128 KB Output is correct
3 Correct 532 ms 8124 KB Output is correct
4 Correct 754 ms 8280 KB Output is correct
5 Correct 595 ms 8132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 609 ms 8120 KB Output is correct
2 Correct 560 ms 8220 KB Output is correct
3 Correct 541 ms 8208 KB Output is correct
4 Correct 735 ms 8132 KB Output is correct
5 Correct 632 ms 8128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 507 ms 9804 KB Output is correct
2 Correct 666 ms 9696 KB Output is correct
3 Correct 635 ms 9696 KB Output is correct
4 Correct 916 ms 9676 KB Output is correct
5 Correct 719 ms 9752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 712 ms 9660 KB Output is correct
2 Correct 652 ms 9800 KB Output is correct
3 Correct 543 ms 9720 KB Output is correct
4 Correct 892 ms 9716 KB Output is correct
5 Correct 865 ms 9772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 578 ms 11188 KB Output is correct
2 Correct 773 ms 11252 KB Output is correct
3 Correct 737 ms 11340 KB Output is correct
4 Execution timed out 1024 ms 11272 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 807 ms 11300 KB Output is correct
2 Correct 753 ms 11468 KB Output is correct
3 Correct 685 ms 11168 KB Output is correct
4 Execution timed out 1024 ms 11272 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 667 ms 12764 KB Output is correct
2 Correct 873 ms 12720 KB Output is correct
3 Correct 837 ms 12888 KB Output is correct
4 Execution timed out 1094 ms 12836 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 915 ms 12784 KB Output is correct
2 Correct 843 ms 12976 KB Output is correct
3 Correct 738 ms 13000 KB Output is correct
4 Execution timed out 1091 ms 12876 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 827 ms 15948 KB Output is correct
2 Execution timed out 1081 ms 15956 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1099 ms 15836 KB Time limit exceeded
2 Halted 0 ms 0 KB -