Submission #940675

#TimeUsernameProblemLanguageResultExecution timeMemory
940675sleepntsheepMobile (BOI12_mobile)C++98
50 / 100
86 ms5720 KiB
#include<stdio.h> #include<math.h> #define N 100000 int n, L; double x[N], y[N]; int main() { scanf("%d%d",&n,&L); for(int i=0;i<n;++i)scanf("%lf%lf",x+i,y+i); double l=0,r=1e9; for (int iter=200;iter--;) { double m=(l+r)/2,rr=0; for(int i=0;i<n;++i) { if(m*m>=y[i]*y[i]) { double dx=sqrt(m*m-y[i]*y[i]); if(x[i]-dx<=rr) if(x[i]+dx>rr)rr=x[i]+dx; } } if(rr>=L) r=m; else l=m; } printf("%.6lf",r); }

Compilation message (stderr)

mobile.cpp: In function 'int main()':
mobile.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d%d",&n,&L);
      |     ~~~~~^~~~~~~~~~~~~~
mobile.cpp:13:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     for(int i=0;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...