Submission #974143

#TimeUsernameProblemLanguageResultExecution timeMemory
974143AksLolCodingMobile (BOI12_mobile)C++17
90 / 100
1083 ms49128 KiB
#include <bits/stdc++.h> using namespace std; using ld = long double; using ld2 = array<ld, 2>; const ld diff = 1e-5; int n; ld h; vector<ld2> pts; ld2 range(ld dist, ld2& pt) { ld dx = sqrt(dist*dist - pt[1]*pt[1]); return {pt[0] - dx, pt[0] + dx}; } bool check(ld dist) { ld left = 0; for (ld2& pt: pts) { ld2 r = range(dist, pt); if (r[0] <= left) left = max(left, r[1]); } return (left >= h); } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> h; pts.resize(n); for (auto& i: pts) cin >> i[0] >> i[1]; // solve ld l = 0, r = 2e9, m; while (r - l > diff) { m = (r + l) / 2; if (check(m)) r = m; else l = m; } printf("%.5Lf\n", m); }
#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...