# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
906167 | Ludissey | Mobile (BOI12_mobile) | C++14 | 409 ms | 10628 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
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<int,int>> a;
for (int i = 0; i < N; i++){
int x,y; cin >> x >> y;
y=abs(y);
if(i>0&&a[a.size()-1].first==x) a[a.size()-1].second=min(a[a.size()-1].second,y);
else{
a.push_back({x,y});
}
}
N=a.size();
double l=0,r=1e9;
while(r-l>0.0009){
double mid=(l+r)/2;
double rght=0;
for (int i = 0; i < a.size(); i++)
{
if(mid<(double)a[i].second) continue;
double pnt1=a[i].first-sqrt((mid*mid)-((double)a[i].second*(double)a[i].second)),pnt2=(double)a[i].first+sqrt((mid*mid)-((double)a[i].second*(double)a[i].second));
if(pnt1<=rght) rght=max(rght, pnt2);
}
if(rght>=L) {
r=mid;
}else{
l=mid;
}
}
cout << setprecision(3) << fixed << l << "\n";
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |