Submission #231339

#TimeUsernameProblemLanguageResultExecution timeMemory
231339DodgeBallManMobile (BOI12_mobile)C++14
50 / 100
94 ms3832 KiB
#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("%lld %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 (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:20:27: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
     scanf("%lld %lf",&n,&L);
                      ~~   ^
mobile.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...