# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1100989 | hoangteo0103 | Mobile (BOI12_mobile) | C++17 | 734 ms | 35400 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;
void setIO(string s){
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
if(fopen("trash.in", "r"))
freopen("trash.in", "r", stdin) , freopen("trash.out", "w", stdout);
}
int main(){
setIO("hoangteo0103");
int n, len;
cin >> n >> len;
vector<array<double, 2>> a(n);
for(int i = 0 ; i < n ; i++) cin >> a[i][0] >> a[i][1];
double ans;
auto check = [&](double lim) -> bool {
double prev = 0;
for(int i = 0 ; i < n ; i++) {
double edge = sqrt(lim * lim - a[i][1] * a[i][1]) ;
double l = a[i][0] - edge, r = a[i][0] + edge;
if(l <= prev) prev = max(prev, r);
}
return prev >= len;
};
double l = 0, r = 1.5e9;
while(r - l > 1e-6) {
double mid = (l+r)/2;
if(check(mid)) {
ans = mid ;
r = mid;
} else {
l = mid;
}
}
cout << fixed << setprecision(6) << ans;
}
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... |