Submission #998939

#TimeUsernameProblemLanguageResultExecution timeMemory
998939hippo123Mobile (BOI12_mobile)C++17
100 / 100
711 ms35412 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pr pair<ll, ll> #define pb push_back #define f first #define s second vector<pr> d(1000001); int n; double L; bool comp(pr a, pr b){ if(a.f==b.f) return a.s*a.s<b.s*b.s; return a.f<b.f; } int main(){ cin>>n>>L; for (int i=0; i<n; i++) { cin>>d[i].f>>d[i].s; } //sort(d.begin(), d.begin()+n, comp); //for (int i=0; i<n; i++) cout<<d[i].f<<" " <<d[i].s<<" :"<<endl; double lft=0; double rht=1.5e9; while (rht-lft>1e-4){ double mid=(rht+lft)/2; double curr=0; for (int i=0; i<n; i++){ double dx=sqrt(mid*mid-d[i].s*d[i].s); double x1, x2; x1=d[i].f-dx; x2=d[i].f+dx; if(x1<=curr) curr=max(curr, x2); } if(curr>=L) rht=mid; else lft=mid; } cout << fixed <<setprecision(4); cout<<lft<<endl; }
#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...