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;
#define sz(x) (int)(x).size()
const int MAXN = 1e6;
int n;
double l;
pair<double, double> v[MAXN];
bool check(double rad){
vector<pair<double, double>> intervals(n);
for(int i = 0; i < n; i++){
intervals[i].first = max(v[i].first - sqrt(rad * rad - v[i].second * v[i].second), (double)0);
intervals[i].second = min(v[i].first + sqrt(rad * rad - v[i].second * v[i].second), l);
}
// sort(intervals.begin(), intervals.end());
if(intervals[0].first != 0 || intervals[n-1].second != l) return false;
for(int i = 0; i < n-1; i++){
if(intervals[i].second < intervals[i + 1].first) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
cin >> n >> l;
for(int i = 0; i < n; i++){
cin >> v[i].first >> v[i].second;
}
// cout << check(5.55);
double low = 0, high = (double)2e9;
while (low + 0.0001 < high) {
double mid = low + (high - low) / 2;
if (check(mid)) high = mid;
else low = mid;
}
cout << setprecision(15) << low << '\n';
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... |