Submission #1127970

#TimeUsernameProblemLanguageResultExecution timeMemory
1127970Climber420Mobile (BOI12_mobile)C++20
0 / 100
1097 ms31760 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for(int i= 0; i<(n); i++) #define reps(i,s, n) for(int i= (s); i<(n); i++) #define each(a, x) for (auto &a : x) #define vv(T) vector<T> #define endl '\n' #define sz(x) (int)x.size() #define ll long long #define all(c) begin(c), end(c) #define fi first #define se second #define mp make_pair #define pb push_back #define wr cout<< #define wre wr endl; #define wrut(a) {wre each(iii,(a))wr iii<<" "; wre} #define wrot(a,b,c) {wre wr a<<" "<<b<<" "<<c; wre} // #define int ll #define ld long double constexpr int mn=1e6 +8; constexpr ld e = 1e-3, inf =1e10; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,L; cin>>n>>L; ld x,y; vector<pair<ld,ld>>stacje(n); rep(i,n){ cin>>x>>y; stacje[i]={x,abs(y)}; } auto check = [&](ld r){ vector<pair<ld,ld>>segs; segs.reserve(n); ld ml=inf, mr =-inf; each(s, stacje){ ld d= sqrt(r*r - s.se*s.se); ld a = s.fi -d; ld b = s.fi +d; if (b<0||a>L)continue; if (mr==-inf){ ml=a;mr=b; }else{ if (a<=mr){ ml=min(ml,a); mr=max(mr,b); } } } return (ml<=0&&mr>=L); }; ld l = 0, r = 1e9,mid; while(r-l>e){ mid=(l+r)/2; if (check(mid))r=mid; else l=mid; } wr fixed<<setprecision(5)<<mid; }
#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...