Submission #898430

#TimeUsernameProblemLanguageResultExecution timeMemory
898430ivazivaMobile (BOI12_mobile)C++14
0 / 100
481 ms24768 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...