Submission #1042242

#TimeUsernameProblemLanguageResultExecution timeMemory
1042242sssamuiMobile (BOI12_mobile)C++17
0 / 100
716 ms32620 KiB
#include <iostream> #include <cstdio> #include <vector> #include <cmath> #include <stack> #include <iomanip> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; double L; cin >> n >> L; vector<pair<double, double>> xy(n); for (int i = 0; i < n; i++) cin >> xy[i].first >> xy[i].second; double l = 0, r = 4e9; int it = 45; while (it--) { double m = (l + r) / 2; stack<pair<double, double>> c; for (int i = 0; i < n; i++) { double sq = sqrt(m * m - xy[i].second * xy[i].second); double a = fmax(0, xy[i].first - sq), b = fmin(L, xy[i].first + sq); while (!c.empty() && (c.top().second >= a)) { a = fmin(a, c.top().first), b = fmax(b, c.top().second); c.pop(); } c.push({ a, b }); } if ((c.size() != 1) || ((c.top().first > 0) || (c.top().second < L))) l = m; else r = m; } cout << fixed << setprecision(3) << l; }
#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...