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>
#define ALL(x) (x).begin(), (x).end()
#define REP(i, a, b) for (int i = (a); i < (b); i++)
#define READ(arr, n) for (int i = 0; i < (n); i++) cin >> arr[i];
#define ABS(a) (max((a), -(a)))
#define MOD 1000000007
using namespace std;
typedef long long ll;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n; long double l;
cin >> n >> l;
long double x[n];
long double y[n];
long double right = 0;
for (int i = 0; i < n; i++) cin >> x[i] >> y[i], right = max(right, sqrtl(x[i]* x[i] + y[i]*y[i])), right = max(right, sqrtl((x[i]-l)*( x[i]-l) + y[i]*y[i]));
long double left = 0;
while ((right-left) > (0.0005)){
long double mid = (left+right)/2;
pair<long double, long double> ranges[n];
for (int i = 0; i < n; i++){
long double sqr = sqrtl(max(mid*mid-y[i]*y[i], (long double) 0));
ranges[i].first = x[i]-sqr;
ranges[i].second = x[i]+sqr;
}
sort(ranges, ranges+n);
long double bound = 0;
for (int i = 0; i < n; i++){
if (ranges[i].first <= bound){
bound = max(bound, ranges[i].second);
}
}
if (bound >= l){
right = mid;
}else{
left = mid;
}
}
cout << left << endl;
}
# | 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... |