Submission #990342

#TimeUsernameProblemLanguageResultExecution timeMemory
990342SkaMobile (BOI12_mobile)C++14
4 / 100
1070 ms12816 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n; long double m; long double x[N], y[N]; pair<long double, long double> calc(long double r, int i) { if (r < y[i]) { return {-1, -1}; } return {x[i] - sqrtl(r * r - y[i] * y[i]), x[i] + sqrtl(r * r - y[i] * y[i])}; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; long double l = 2e9, r = 2e9; for (int i = 1; i <= n; ++i) { cin >> x[i] >> y[i]; l = min(l, abs(y[i])); } int iter = 60; while (iter--) { vector<pair<long double, long double>> segments; long double mid = (l + r) / 2; for (int i = 1; i <= n; ++i) { auto x = calc(mid, i); if (x.first != -1 && x.second != -1) { segments.emplace_back(x.first, x.second); } } sort(segments.begin(), segments.end()); long double bound = 0; for (auto x : segments) { if (x.first > bound) { break; } bound = max(bound, x.second); if (bound >= m) { break; } } if (bound >= m) { r = mid; } else { l = mid; } } cout << fixed << setprecision(6) << l << '\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...