Submission #374761

#TimeUsernameProblemLanguageResultExecution timeMemory
374761wzyMobile (BOI12_mobile)C++17
17 / 100
1095 ms15980 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000005; int n , L; pair<long long,long long> v[N]; double f(double mid){ double cur = 0.00; for(int i = 1 ; i <= n; i ++){ long long dy = v[i].second * v[i].second; double len = sqrt(mid*mid - 1.00 * dy); if(cur >= (1.00 * v[i].first - len)) cur = max(cur , 1.00*v[i].first + len); } return cur >= L; } int32_t main(){ scanf("%d%d" , &n , &L); for(int i = 1; i <= n; i ++){ scanf("%lld%lld" , &v[i].first , &v[i].second); } sort(v + 1 , v + 1 + n); double l = 0.000 , r = 1e12; while(r-l > 1e-9){ double mid = l + (r-l)/2; if(f(mid)) r = mid; else l = mid; } printf("%.6lF" , l); }

Compilation message (stderr)

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