# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
898467 | ivaziva | Mobile (BOI12_mobile) | C++14 | 482 ms | 15964 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 MAXN 1000010
long long n,x;
long long a1[MAXN];
long long a2[MAXN];
int main()
{
cin>>n>>x;
long long poz=1;
cin>>a1[1]>>a2[1];poz++;
for (long long i=2;i<=n;i++)
{
long long xx,yy; cin>>xx>>yy;
if (a1[poz-1]==xx) continue;
a1[poz]=xx;a2[poz]=yy;poz++;
}
poz--;
double dist=-LLONG_MAX*1.00;
double ans=-1.00;
for (long long i=2;i<=poz;i++)
{
double l=a1[i-1];
double r=a1[i];
while (r-l>=0.0001)
{
double mid=(l+r)/2;
double dist1=(mid-a1[i-1]*1.00)*(mid-a1[i-1]*1.00)+a2[i-1]*a2[i-1]*1.00;
double dist2=(mid-a1[i]*1.00)*(mid-a1[i]*1.00)+a2[i]*a2[i]*1.00;
if (dist1>dist2) r=mid;
else l=mid;
}
double val=(a1[i-1]*1.00-l)*(a1[i-1]*1.00-l)+a2[i-1]*a2[i-1]*1.00;
if (val>dist){dist=val;ans=l;}
}
cout<<fixed<<showpoint<<setprecision(4)<<dist<<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... |