Submission #898431

# Submission time Handle Problem Language Result Execution time Memory
898431 2024-01-04T16:18:56 Z ivaziva Mobile (BOI12_mobile) C++14
0 / 100
476 ms 16064 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-1]*a2[i-1]*1.00;
        if (val>dist){dist=val;ans=l;}
    }
    cout<<fixed<<showpoint<<setprecision(4)<<ans<<endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 1 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2396 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 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 43 ms 4720 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 52 ms 4688 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 220 ms 11088 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 296 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 262 ms 15184 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 298 ms 2392 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 341 ms 15208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 329 ms 2492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 352 ms 15192 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 376 ms 2500 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 436 ms 16064 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 476 ms 2488 KB Output isn't correct
2 Halted 0 ms 0 KB -