# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112589 | zoooma13 | Mobile (BOI12_mobile) | C++14 | 1082 ms | 10744 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;
#define MAX_N 1000006
int n ,l;
int x[MAX_N] ,y[MAX_N];
bool can(double X)
{
double mx = 0;
for(int i=0; i<n; i++){
if(y[i]-X > 1e-6)
continue;
double len = sqrt((X*X)-(1.0*y[i]*y[i]));
if(x[i]-len-mx > 1e-6)
return 0;
mx = max(mx ,x[i]+len);
}
return (mx >= l);
}
int main()
{
scanf("%d%d",&n,&l);
for(int lx=-2e9 ,i=0; i<n; i++)
{
scanf("%d%d",&x[i],&y[i]) ,y[i] = abs(y[i]);
if(lx == x[i]){
y[i-1] = min(y[i-1] ,y[i]);
i-- ,n--;
}lx = x[i];
}
double st = 0 ,en = 1e18 ,mid;
for(int ee=200; ee; ee--){
mid = (st+en)/2;
if(can(mid))
en = mid;
else
st = mid;
}
cout << fixed << setprecision(6) << en << endl;
}
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... |