Submission #919366

#TimeUsernameProblemLanguageResultExecution timeMemory
919366ethanv13Mobile (BOI12_mobile)C++17
0 / 100
1055 ms66124 KiB
#include <bits/stdc++.h> using namespace std; vector<pair<long long,long long>>c;long long n,l; bool can(long double mid){ vector<pair<long double,long double>>seg; for(int i=0;i<n;++i){ if(mid<abs(c[i].second)){ return false; } else { long double delta=sqrt(mid*mid-c[i].second*c[i].second); seg.push_back({c[i].first-delta,c[i].first+delta}); } } long double minx=4e9; long double currub=-4e9; for(int i=0;i<n;++i){ if(minx>seg[i].first){ minx=seg[i].first; } if(seg[i].first<=currub||currub==-4e9){ currub=seg[i].second;continue; } else { return false; } } return currub>=l&&minx<=0; } int main() { cin>>n>>l; for(int i=0;i<n;++i){ long long x,y;cin>>x>>y;c.push_back({x,y}); } long double lo=0;long double hi=2e9; for(int i=0;i<50;++i){ long double mid=(lo+hi)/2; if(can(mid)){ hi=mid; } else { lo=mid; } } cout<<fixed<<setprecision(9); cout<<lo<<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...