Submission #963069

#TimeUsernameProblemLanguageResultExecution timeMemory
963069alecurseMobile (BOI12_mobile)C++14
8 / 100
1085 ms63064 KiB
#include <iostream> #include <vector> #include <math.h> #define mp make_pair #define double long double using namespace std; int N; double L; vector<pair<double,double> > points; vector<pair<double,double> > segs; bool test(double r) { for(int i=0;i<N;i++) { double x = points[i].first, y=points[i].second; double d = sqrt(r*r-y*y); segs[i].first=x-d; segs[i].second=x+d; } double left=0; for(int i=0;i<N;i++) { if(segs[i].first<=left) { left=max(left,segs[i].second); } } return left>=L; } int main() { cin>>N>>L; segs.resize(N); points.resize(N); for(int i=0;i<N;i++) { cin>>points[i].first>>points[i].second; } double a = 1, b=1e9; double res=1e9; while(abs(a-b)>=1e-5) { double k=(a+b)/2; if(test(k)) { res=min(res,k); b=k; } else { a=k; } } cout<<res; }
#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...