Submission #898467

# Submission time Handle Problem Language Result Execution time Memory
898467 2024-01-04T17:20:11 Z ivaziva Mobile (BOI12_mobile) C++14
0 / 100
482 ms 15964 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)<<dist<<endl;
    }

Compilation message

mobile.cpp: In function 'int main()':
mobile.cpp:24:16: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   24 |         double ans=-1.00;
      |                ^~~
# 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 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 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 37 ms 4696 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 6740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 50 ms 4700 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 6776 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 211 ms 10848 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 249 ms 2668 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 270 ms 14948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 304 ms 2748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 295 ms 14952 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 330 ms 2728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 335 ms 14936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 377 ms 2652 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 435 ms 15964 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 482 ms 2484 KB Output isn't correct
2 Halted 0 ms 0 KB -