Submission #754183

#TimeUsernameProblemLanguageResultExecution timeMemory
754183lukehsiaoMobile (BOI12_mobile)C++14
100 / 100
362 ms35232 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int mxN = 1e6; ll n, L, x[mxN], y[mxN]; bool works(double r) { double cur = 0; for (int i=0; i<n; ++i) { double d = r*r - y[i]*y[i]; if (d >= 0) { double del = sqrt(d); if (x[i]-del <= cur) cur = max(cur, x[i]+del); } } return cur >= L; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> L; for (int i=0; i<n; ++i) cin >> x[i] >> y[i]; double lo = 0, hi = 3e9; while (hi-lo > 1e-3) { double mid = (lo+hi)/2; if (works(mid)) hi = mid; else lo = mid; } cout << fixed << setprecision(4) << (lo+hi)/2 << '\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...