Submission #965070

#TimeUsernameProblemLanguageResultExecution timeMemory
965070pccMobile (BOI12_mobile)C++17
8 / 100
936 ms57064 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; vector<pll> arr; 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 = 1e9*sqrt(2); cin>>N>>L; for(int i = 0;i<N;i++){ pll tmp; cin>>tmp.fs>>tmp.sc; if(i&&tmp.fs == arr.back().fs)arr.back().sc = min(arr.back().sc,tmp.sc); else arr.push_back(pll(tmp.fs,abs(tmp.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...