Submission #231344

# Submission time Handle Problem Language Result Execution time Memory
231344 2020-05-13T11:31:58 Z DodgeBallMan Mobile (BOI12_mobile) C++14
50 / 100
83 ms 3320 KB
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 10;
int n;
double L, x[N], y[N];

bool check( double mid ) {
    double mx = 0;
    for( int i = 1 ; i <= n ; i++ ) {
        double len = sqrt( mid*mid - y[i]*y[i] );
        double le = x[i] - len, ri = x[i] + len;
        if( le <= mx ) mx = max( mx, ri );
    }
    return ( mx >= ( double )L );
}
int main()
{
    scanf("%d %lf",&n,&L);
    for( int i = 1 ; i <= n ; i++ ) scanf("%lf %lf",&x[i],&y[i]);
    double l = 1, r = 5e8;
    while( r - l > 0.001 ) {
        double mid = ( l + r ) / 2.0;
        if( check( mid ) ) r = mid;
        else l = mid;
    }
    printf("%.4lf",l);
    return 0;
}

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %lf",&n,&L);
     ~~~~~^~~~~~~~~~~~~~~~
mobile.cpp:21:42: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for( int i = 1 ; i <= n ; i++ ) scanf("%lf %lf",&x[i],&y[i]);
                                     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 384 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 384 KB Output is correct
2 Correct 7 ms 512 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 512 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 384 KB Output is correct
2 Correct 7 ms 512 KB Output is correct
3 Correct 7 ms 384 KB Output is correct
4 Correct 8 ms 512 KB Output is correct
5 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2296 KB Output is correct
2 Correct 43 ms 2680 KB Output is correct
3 Correct 33 ms 1792 KB Output is correct
4 Correct 57 ms 2680 KB Output is correct
5 Correct 31 ms 1536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 50 ms 2296 KB Output is correct
2 Correct 48 ms 2304 KB Output is correct
3 Correct 56 ms 2560 KB Output is correct
4 Correct 60 ms 2808 KB Output is correct
5 Correct 64 ms 2936 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 2296 KB Output is correct
2 Correct 46 ms 2808 KB Output is correct
3 Correct 49 ms 2552 KB Output is correct
4 Correct 79 ms 3320 KB Output is correct
5 Correct 58 ms 2680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 3192 KB Output is correct
2 Correct 55 ms 3192 KB Output is correct
3 Correct 59 ms 2936 KB Output is correct
4 Correct 81 ms 3196 KB Output is correct
5 Correct 71 ms 3064 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 55 ms 3192 KB Output is correct
2 Correct 54 ms 3096 KB Output is correct
3 Correct 59 ms 2936 KB Output is correct
4 Correct 83 ms 3192 KB Output is correct
5 Correct 69 ms 3192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 2936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 3196 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 2936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 3152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 2936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 46 ms 2552 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 2552 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 46 ms 1912 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 1912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 46 ms 1896 KB Time limit exceeded (wall clock)
2 Halted 0 ms 0 KB -