제출 #702612

#제출 시각아이디문제언어결과실행 시간메모리
702612nguyenneheheMobile (BOI12_mobile)C++14
0 / 100
1081 ms40360 KiB
#include "bits/stdc++.h" using namespace std; const int INF = 1e9 + 7; int32_t main() { cin.tie(0)->sync_with_stdio(0); int n, L; cin >> n >> L; vector<pair<int, int>> a(n); for (auto &x: a) cin >> x.first >> x.second; auto good = [&](double R) { vector<pair<double, double>> b; for (auto i: a) { long long u, v; tie(u, v) = i; #define sqr(x) (x) * (x) double delta = sqrt(sqr(R) - sqr(v)); double x1 = -delta + u, x2 = delta + u; b.emplace_back(x1, x2); // cout << fixed << setprecision(10) << x1 << ' ' << x2 << '\n'; } sort(b.begin(), b.end(), [](pair<double, double> x, pair<double, double> y) { if (x.second == y.second) return x.first < y.first; return x.second > y.second; }); double l = INF, r = -INF; for (auto i: b) { if (l == INF) { l = min(l, i.first); r = max(r, i.second); continue; } if (i.second < l || i.first > r) return false; l = min(l, i.first), r = max(r, i.second); } return l <= 0 && r >= L; }; double l = -1, r = 1e9 + 1; for (int i = 1, ITER = 80; i <= ITER; ++i) { double m = l + (r - l) / 2; if (good(m)) r = m; else l = m; } cout << fixed << setprecision(20) << r; }
#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...