Submission #973162

#TimeUsernameProblemLanguageResultExecution timeMemory
973162jadai007Mobile (BOI12_mobile)C++17
0 / 100
694 ms44024 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; for(int i=1; i<=n; i++) { int dis = sqrt(mid*mid - y[i]*y[i]); vc.emplace_back(x[i] - dis, x[i] + dis); } for(auto i: vc) if(i.first <= ans) ans = max(ans, i.second); if(ans >= L) return 1; else return 0; } 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.0; 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...