Submission #374748

#TimeUsernameProblemLanguageResultExecution timeMemory
374748wzyMobile (BOI12_mobile)C++17
0 / 100
1090 ms9964 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000005; int x[N] , n , L , y[N]; double f(double mid){ double ans = 0.00; for(int i = 1; i <= n; i ++){ ans = max(ans , hypot(fabs(x[i] - mid) , y[i])); } return ans; } int32_t main(){ scanf("%d%d" , &n , &L); for(int i = 1; i <= n; i ++){ scanf("%d%d" , &x[i] , &y[i]); } double l = 0.00 , r = L; while(r - l > 1e-9){ double ml = l + (r-l)/3 , mr = r - (r-l)/3; if(f(ml) > f(mr)) l = ml; else r = mr; } printf("%.9lf" , f(l)); }

Compilation message (stderr)

mobile.cpp: In function 'int32_t main()':
mobile.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   16 |  scanf("%d%d" , &n , &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |   scanf("%d%d" , &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...