Submission #231346

#TimeUsernameProblemLanguageResultExecution timeMemory
231346DodgeBallManMobile (BOI12_mobile)C++14
100 / 100
745 ms35288 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 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 >= 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 (stderr)

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 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...