Submission #898430

# Submission time Handle Problem Language Result Execution time Memory
898430 2024-01-04T16:18:00 Z ivaziva Mobile (BOI12_mobile) C++14
0 / 100
481 ms 24768 KB
#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]*a2[i]*1.00;
        if (val>dist){dist=val;ans=l;}
    }
    cout<<fixed<<showpoint<<setprecision(4)<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2540 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 44 ms 5340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 3152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 7248 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 6224 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 8024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 217 ms 14932 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 245 ms 10576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 269 ms 19928 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 285 ms 12372 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 310 ms 21024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 332 ms 13864 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 354 ms 21992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 385 ms 15700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 438 ms 24768 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 481 ms 19028 KB Output isn't correct
2 Halted 0 ms 0 KB -