Submission #470633

#TimeUsernameProblemLanguageResultExecution timeMemory
470633zxcvbnmMobile (BOI12_mobile)C++14
100 / 100
510 ms31432 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; struct P { ll x, y; }; vector<P> a; int n, L; bool ok(double r) { double curr = 0; for(int i = 0; i < n; i++) { if (r * r < a[i].y * a[i].y) continue; double sol = sqrt(r * r - a[i].y * a[i].y); double left = max((double) 0, a[i].x - sol); double right = min((double) L, a[i].x + sol); if (left <= curr) { curr = max(curr, right); } } return curr >= L; } signed main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> L; a.resize(n); for(auto& i : a) { cin >> i.x >> i.y; } double l = 0, r = 1e9; double ans = r; for(int rep = 0; rep < 40; rep++) { double mid = (l + r) / 2; if (ok(mid)) { r = mid; ans = mid; } else { l = mid; } } cout << fixed << setprecision(6) << ans << "\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...