Submission #963064

#TimeUsernameProblemLanguageResultExecution timeMemory
963064alecurseMobile (BOI12_mobile)C++17
8 / 100
1018 ms48208 KiB
#include <iostream> #include <vector> #include <math.h> #define mp make_pair using namespace std; int N, 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; if(r<y) { segs[i].first=-1; continue; } 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==-1) { continue; } 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 = 0, b=1e9; double res=1e9; while(abs(a-b)>=1e-4) { 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...