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 <iostream>
#include <iomanip>
#include <cmath>
#define ll long long
using namespace std;
ll n,len;
pair<ll,ll> a[1000005];
//ll lungimi[1000006];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>len;
for (int i = 1;i<=n;++i) {
cin>>a[i].first>>a[i].second;
}
double l = 1,r = 1.5e9;
while(r-l>1e-3) {
double mid = (l+r)/2,curr = 0;
for (int i = 1;i<=n;++i) {
// aflam prt dr si st
double st,dr,dif;
dif = sqrt((mid*mid)-(a[i].second*a[i].second));
st = a[i].first-dif,dr = a[i].first+dif;
if (st<=curr) {
curr=max(curr,dr);
}
}
if (curr >= len)
r = mid;
else
l = mid;
}
cout<<fixed<<setprecision(4)<<l;
return 0;
}
# | 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... |