Submission #738462

#TimeUsernameProblemLanguageResultExecution timeMemory
738462LKR__enjoyerMobile (BOI12_mobile)C++17
100 / 100
551 ms12836 KiB
#include <iostream> #include<bits/stdc++.h> #define pb push_back #define f first #define s second typedef long long ll; typedef long double ld; using namespace std; int n,l; vector<pair<int,int>> pkt; bool spr(long double rad); long double bin(ld lo,ld hi) { for(int i=0;i<40;i++) { ld mid=(lo+hi)/2; if(spr(mid))hi=mid; else lo=mid; } return lo; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin>>n>>l; for(int i=0;i<n;i++) {int a,b; cin>>a>>b; pkt.pb({a,b}); } cout<<fixed<<setprecision(4)<<bin(0,(ld)(2*l)); return 0; } bool spr(ld rad){ ld curr_min=1.5e9+1,curr_max=-1.5e9-1; for(int i=0;i<n;i++) { ld x=(ld)pkt[i].f,y=(ld)pkt[i].s; if(rad<abs(y))continue; ld del=(ld)sqrt(rad*rad-y*y); ld a=x-del,b=x+del; if(b<0)continue; if(curr_min==1.5e9+1&&curr_max==-1.5e9-1){curr_min=a; curr_max=b; continue;} if(a<=curr_max)curr_max=max(curr_max,b); if(b>=curr_min)curr_min=min(curr_min,a); } if(curr_min>0||curr_max<(ld)l)return 0; return 1; }
#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...