Submission #374762

#TimeUsernameProblemLanguageResultExecution timeMemory
374762wzyMobile (BOI12_mobile)C++17
100 / 100
668 ms27628 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000005; int n , L; pair<int,int> v[N]; double f(double mid){ double cur = 0.00; for(int i = 1 ; i <= n; i ++){ double len = sqrt(mid*mid - 1.00 * (1ll * v[i].second)* (1ll * v[i].second)); 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("%d%d" , &v[i].first , &v[i].second); } sort(v + 1 , v + 1 + n); double l = 0.000 , r = 4e9; while(r-l > 1e-6){ 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:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |  scanf("%d%d" , &n , &L);
      |  ~~~~~^~~~~~~~~~~~~~~~~~
mobile.cpp:20:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   20 |   scanf("%d%d" , &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...