Submission #639218

#TimeUsernameProblemLanguageResultExecution timeMemory
639218PietraMobile (BOI12_mobile)C++14
100 / 100
830 ms16212 KiB
#include<bits/stdc++.h> using namespace std ; const int maxn = 2e6 + 5 ; const double inf = 2e9 + 5 ; double n, l, x[maxn], y[maxn] ; bool check(double r){ double f = 0 ; for(int i = 1 ; i <= n ; i++){ if(r < y[i]) continue ; double dx = sqrt(((r*r) - (y[i]*y[i]))) ; double ini = x[i] - dx, fim = x[i] + dx ; if(ini <= f) f = max(f, fim) ; } return (f >= l) ; } int main(){ ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cin >> n >> l ; for(int i = 1 ; i <= n ; i++) cin >> x[i] >> y[i] ; double ini = 0, fim = inf, mid ; int it = 41 ; while(it--){ mid = (ini + fim)/2 ; if(check(mid)) fim = mid ; else ini = mid ; } cout << fixed << setprecision(4) << fim << "\n" ; }
#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...