Submission #432326

#TimeUsernameProblemLanguageResultExecution timeMemory
432326four_specksMobile (BOI12_mobile)C++17
50 / 100
1097 ms48264 KiB
#include <bits/stdc++.h> using namespace std; void solve() { struct point { long x, y; }; int n; long l; cin >> n >> l; vector<point> coords(n); for (int i = 0; i < n; i++) cin >> coords[i].x >> coords[i].y; auto valid = [&](const double &d) -> bool { vector<pair<double, double>> cov; for (auto [x, y] : coords) { if (y * y < d * d) { double h = sqrt(d * d - y * y); cov.emplace_back(x - h, x + h); } } sort(cov.begin(), cov.end()); bool ended = 0; double e = 0.0; for (auto [x1, x2] : cov) { if (x1 <= e) { e = max(e, x2); if (e >= l) { ended = 1; break; } } else break; } return ended; }; double ans = 1e15; for (double lo = 0.5; ans - lo > 1e-5;) { if (double mid = (lo + ans) / 2.0; valid(mid)) ans = mid; else lo = mid + 1e-4; } cout << fixed << setprecision(5) << ans << '\n'; } int main() { ios_base::sync_with_stdio(false), cin.tie(NULL); solve(); return 0; }
#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...