Submission #906202

#TimeUsernameProblemLanguageResultExecution timeMemory
906202LudisseyMobile (BOI12_mobile)C++14
100 / 100
824 ms15964 KiB
#include <bits/stdc++.h> using namespace std; #define int double double dist(double x1, double y1, double x2, double y2){ double dist=sqrt(pow((x1-x2),2)+pow((y1-y2),2)); return dist; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N,L; cin >> N >> L; vector<pair<double,double>> a(N); for (int i = 0; i < N; i++){ cin >> a[i].first >> a[i].second; a[i].second=abs(a[i].second); } int l=0,r=L; int ans; while(r-l>0.0003){ int mid=(l+r)/2; int rght=0; for (int i = 0; i < N; i++) { int pnt1=a[i].first-sqrt(pow(mid,2)-pow(a[i].second,2)),pnt2=a[i].first+sqrt(pow(mid,2)-pow(a[i].second,2)); if(mid>=a[i].second){ if(pnt1<=rght) rght=max(rght, pnt2); } } if(rght>=L) { r=mid; ans=r; }else{ l=mid; } } cout << setprecision(5) << fixed << (double)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...