Submission #409997

#TimeUsernameProblemLanguageResultExecution timeMemory
409997BERNARB01Mobile (BOI12_mobile)C++17
0 / 100
1096 ms65368 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, L; cin >> n >> L; vector<pair<long long, long long>> p(n); for (long long i = 0; i < n; i++) { cin >> p[i].first >> p[i].second; } long double l = -1, r = 2e9 + 1; for (long long itr = 0; itr < 1000; itr++) { long double mid = (l + r) / 2.0; vector<pair<long double, long double>> v; long long ok = 1; for (long long i = 0; i < n; i++) { long double b = -2.0 * p[i].first; long double c = (p[i].first * p[i].first) + (p[i].second * p[i].second) - (mid * mid); long double delta = (b * b) - 4.0 * c; if (delta < 0) { continue; } long double lb = (-b - sqrtl(delta)) / 2.0, rb = (-b + sqrtl(delta)) / 2.0; if (lb > (long double) L) { continue; } while (!v.empty() && lb < v.back().first) { v.pop_back(); } if (!v.empty() && v.back().second < lb) { ok = 0; break; } v.push_back({lb, rb}); } if (v.empty() || !ok || (!v.empty() && ((min((long double) L, end(v)[-1].second) - max(v[0].first, (long double) 0.0)) < (long double) L))) { l = mid; } else { r = mid; } } cout << setprecision(4) << fixed << (r + l) / 2.0 << '\n'; 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...