Submission #356767

#TimeUsernameProblemLanguageResultExecution timeMemory
356767penguinhackerMobile (BOI12_mobile)C++14
28 / 100
1097 ms57612 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array const int mxN = 1000000; int n, l, x[mxN], y[mxN]; bool ok(double d) { // vector<pair<double, double>> d; vector<pair<double, int>> e; for (int i = 0; i < n; ++i) { if (abs(y[i]) < d) { double r = sqrt(d * d - (ll)y[i] * y[i]); double ls = x[i] - r; double rs = x[i] + r; if (rs > 0 && ls < l) { ls = max(ls, 0.0); rs = min(rs, l + 1e-9); // d.emplace_back(ls, rs); e.emplace_back(ls, -1); e.emplace_back(rs, 1); } } } // for (auto& x : e) cout << x.first << " " << x.second << "\n"; sort(e.begin(), e.end()); if (e[0].first != 0 || e.back().first < l) return 0; int cur = 0; for (int i = 0; i < (int)e.size(); ++i) { cur -= e[i].second; if (i != (int)e.size() - 1 && cur <= 0) return 0; } return 1; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(6); cin >> n >> l; for (int i = 0; i < n; ++i) cin >> x[i] >> y[i]; double lb = 0, rb = 2e9; while(lb + (1e-7) < rb) { double mid = (lb + rb) / 2; if (ok(mid)) rb = mid; else lb = mid; } cout << lb; 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...