Submission #639194

# Submission time Handle Problem Language Result Execution time Memory
639194 2022-09-09T00:03:31 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 = 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, 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 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 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 396 KB Output is correct
2 Correct 5 ms 340 KB Output is correct
3 Correct 4 ms 340 KB Output is correct
4 Correct 6 ms 384 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 5 ms 340 KB Output is correct
3 Correct 5 ms 392 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 5 ms 388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 77 ms 1436 KB Output is correct
2 Correct 82 ms 1492 KB Output is correct
3 Correct 50 ms 1040 KB Output is correct
4 Correct 98 ms 1396 KB Output is correct
5 Correct 39 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 1484 KB Output is correct
2 Correct 79 ms 1392 KB Output is correct
3 Correct 107 ms 1532 KB Output is correct
4 Correct 103 ms 1544 KB Output is correct
5 Correct 120 ms 1576 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 1640 KB Output is correct
2 Correct 88 ms 1564 KB Output is correct
3 Correct 77 ms 1508 KB Output is correct
4 Correct 150 ms 1848 KB Output is correct
5 Correct 90 ms 1612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 111 ms 1752 KB Output is correct
2 Correct 106 ms 1768 KB Output is correct
3 Correct 90 ms 1800 KB Output is correct
4 Correct 147 ms 1792 KB Output is correct
5 Correct 116 ms 1804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 109 ms 1804 KB Output is correct
2 Correct 108 ms 1748 KB Output is correct
3 Correct 89 ms 1860 KB Output is correct
4 Correct 163 ms 1740 KB Output is correct
5 Correct 115 ms 1804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 422 ms 8148 KB Output is correct
2 Correct 556 ms 8160 KB Output is correct
3 Correct 521 ms 8140 KB Output is correct
4 Correct 731 ms 8084 KB Output is correct
5 Correct 612 ms 8072 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 580 ms 8112 KB Output is correct
2 Correct 545 ms 8108 KB Output is correct
3 Correct 457 ms 8168 KB Output is correct
4 Correct 722 ms 8068 KB Output is correct
5 Correct 634 ms 8200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 494 ms 9676 KB Output is correct
2 Correct 674 ms 9680 KB Output is correct
3 Correct 636 ms 9740 KB Output is correct
4 Correct 916 ms 9780 KB Output is correct
5 Correct 706 ms 9652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 691 ms 9724 KB Output is correct
2 Correct 655 ms 9720 KB Output is correct
3 Correct 545 ms 9748 KB Output is correct
4 Correct 885 ms 9612 KB Output is correct
5 Correct 748 ms 9804 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 576 ms 11212 KB Output is correct
2 Correct 797 ms 11212 KB Output is correct
3 Correct 749 ms 11368 KB Output is correct
4 Execution timed out 1037 ms 11336 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 812 ms 11204 KB Output is correct
2 Correct 763 ms 11256 KB Output is correct
3 Correct 663 ms 11344 KB Output is correct
4 Execution timed out 1025 ms 11248 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 663 ms 12712 KB Output is correct
2 Correct 879 ms 12816 KB Output is correct
3 Correct 887 ms 12872 KB Output is correct
4 Execution timed out 1094 ms 12804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 904 ms 12780 KB Output is correct
2 Correct 855 ms 13008 KB Output is correct
3 Correct 769 ms 12828 KB Output is correct
4 Execution timed out 1095 ms 12804 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 831 ms 16016 KB Output is correct
2 Execution timed out 1087 ms 15832 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1094 ms 14284 KB Time limit exceeded
2 Halted 0 ms 0 KB -