Submission #468775

#TimeUsernameProblemLanguageResultExecution timeMemory
468775DDTerziev04Mobile (BOI12_mobile)C++14
100 / 100
554 ms28460 KiB
#include<iostream> #include<cmath> #include<iomanip> using namespace std; const int MAXN=1e6; const double MAXL=1e10; pair<long long, long long> pts[MAXN]; bool CanCover(int n, int m, double l) { double d=0; for(int i=0; i<n; i++) { double x=sqrt(l*l-pts[i].second*pts[i].second); if(pts[i].first-x<=d && pts[i].first+x>=d) { d=pts[i].first+x; } } return d>=m; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; for(int i=0; i<n; i++) { cin >> pts[i].first >> pts[i].second; } double diff=0.001, l=0, r=MAXL, ans; while(r-l>=diff) { double mid=l+(r-l)/2; if(CanCover(n, m, mid)) { ans=mid; r=mid; } else { l=mid; } } cout << fixed << setprecision(4) << ans << "\n"; return 0; }
#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...