Submission #684378

#TimeUsernameProblemLanguageResultExecution timeMemory
684378handlenameMobile (BOI12_mobile)C++17
100 / 100
791 ms31732 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define float long double const int MOD=1e9+7; //const int MOD=998244353; const int sqn=450; const long double eps=1e-4; long double n,l,x[1000002],y[1000002]; void runtc(){ cin>>n>>l; for (int i=1;i<=n;i++){ cin>>x[i]>>y[i]; } long double mini=0,maxi=2e9; while (mini+eps<maxi){ long double mid=(mini+maxi)/2; long double cur=0; for (int i=1;i<=n;i++){ if (mid*mid-y[i]*y[i]<0) continue; long double lol=sqrt(mid*mid-y[i]*y[i]); if (x[i]-lol<=cur) cur=max(cur,x[i]+lol); } if (cur>=l) maxi=mid; else mini=mid; } cout<<fixed<<setprecision(4); cout<<maxi; } int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("moocast.in","r",stdin); //freopen("moocast.out","w",stdout); //freopen("input1.in","r",stdin); //freopen("output1.out","w",stdout); //freopen("perfectly_balanced_chapter_1_input.txt","r",stdin); //freopen("hackercup_output.txt","w",stdout); int tc; //cin>>tc; tc=1; for (int i=1;i<=tc;i++){ //cout<<"Case #"<<i<<": "; runtc(); } }
#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...