Submission #862458

#TimeUsernameProblemLanguageResultExecution timeMemory
862458AndreiVerestiucMobile (BOI12_mobile)C++11
90 / 100
1062 ms50940 KiB
#include <bits/stdc++.h> #define diff 0.00001 #define p pair<double,double> using namespace std; bool Check(double d,vector<p> v,int n,int l) { double curr=0; for (int i=0; i<n; i++) { double x=v[i].first,y=v[i].second; double distance=sqrt(d*d-y*y); double st=x-distance,dr=x+distance; if (st<=curr) curr=max(curr,dr); } return (curr>=l); } int main() { int n,l; cin>>n>>l; vector< p > v(n); for (int i=0; i<n; i++) cin>>v[i].first>>v[i].second; double st=0,dr=1e9,mij; while (abs(dr-st)>diff) { mij=(st+dr)/2; //cout<<st<<' '<<dr<<' '<<mij<<'\n'; if (Check(mij,v,n,l)) dr=mij; else st=mij; } cout<<fixed<<setprecision(6)<<dr<<'\n'; return 0; }
#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...