Submission #973171

#TimeUsernameProblemLanguageResultExecution timeMemory
973171jadai007Mobile (BOI12_mobile)C++17
100 / 100
674 ms48352 KiB
#include<bits/stdc++.h> using namespace std; int n; double L, x[1000100], y[1000100], l = 0, r = 1e9; vector<pair<double, double>> vc; bool solve(double mid){ vc.clear(); double ans = 0.0; for(int i = 1; i <= n; i++) { double dis = sqrt(mid*mid - y[i]*y[i]); vc.emplace_back(x[i] - dis, x[i] + dis); } for(auto x: vc) if(x.first <= ans) ans = max(ans, x.second); return ans >= L; } int main(){ cin.tie(nullptr)->sync_with_stdio(false); cin >> n >> L; for(int i = 1; i<=n; ++i) cin >> x[i] >> y[i]; while(l + 0.0001 < r){ double mid = (l + r) / 2; if(solve(mid)) r = mid; else l = mid + 0.0001; } cout << fixed << setprecision(6) << l; }
#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...