Submission #965027

#TimeUsernameProblemLanguageResultExecution timeMemory
965027pccMobile (BOI12_mobile)C++17
50 / 100
1066 ms58044 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,popcnt,sse4") #define ll long long #define pll pair<ll,ll> #define pii pair<int,int> #define fs first #define sc second #define tlll tuple<ll,ll,ll> #define ld double #define pld pair<ld,ld> const int mxn = 1e6+10; ll N,L; pair<ll,ll> arr[mxn]; inline bool check(ld r){ vector<pld> v; for(int i = 0;i<N;i++){ if(r<arr[i].sc)continue; v.push_back(pld(arr[i].fs-sqrt(r*r-arr[i].sc*arr[i].sc),arr[i].fs+sqrt(r*r-arr[i].sc*arr[i].sc))); if(v.back().fs<0&&v.back().sc>L)return true; } sort(v.begin(),v.end()); ld pre = 0; for(auto &i:v){ if(pre>L)return true; if(pre<i.fs)return false; pre = max(pre,i.sc); } return pre>L; } int main(){ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); ld l = 0,r = 2e9; cin>>N>>L; for(int i = 0;i<N;i++)cin>>arr[i].fs>>arr[i].sc,arr[i].sc = abs(arr[i].sc); for(int i = 0;r-l>0.001;i++){ ld mid = (l+r)/2; if(check(mid))r = mid; else l = mid; } cout<<fixed<<setprecision(10)<<l<<'\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...