Submission #781096

#TimeUsernameProblemLanguageResultExecution timeMemory
781096upedMobile (BOI12_mobile)C++14
100 / 100
378 ms15956 KiB
// ~uped #include<bits/stdc++.h> using namespace std; using ll = long long; void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fastio(); int n, len; cin >> n >> len; vector<pair<ll, ll>> v(n); for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; v[i] = {a, b}; } // binary search radius double l = 0.0, r = 1e10; while (r - l > 1e-3) { double radius = (l + r) / 2.0; double mx = 0; for (int j = 0; j < n; ++j) { ll x = v[j].first; ll y = v[j].second; // a*a+b*b=c*c => c*c-b*b=a*a double a = sqrt( radius * radius - y * y); // we cover segment from x - a to x + a if (x - a <= mx) { mx = max(x + a, mx); } } if (mx >= len) { r = radius; } else { l = radius; } } cout << setprecision(20) << r; 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...