Submission #732496

#TimeUsernameProblemLanguageResultExecution timeMemory
732496uy842003Mobile (BOI12_mobile)C++17
80 / 100
1095 ms25088 KiB
#include <bits/stdc++.h> using namespace std; const double eps = 1e-4; inline bool cmp_less(const double &a, const double &b) { return a + eps < b; } inline bool cmp_equal(const double &a, const double &b) { return abs(a - b) < eps; } inline bool cmp_less_equal(const double &a, const double &b) { return cmp_less(a, b) || cmp_equal(a, b); } int main() { int n; double len; cin >> n >> len; vector<pair<double, double>> cor(n); for (int i = 0; i < n; i++) cin >> cor[i].first >> cor[i].second; double l = 0, r = 1e10, m; while (cmp_less(l, r)) { m = (l + r) / 2; double cur_pos = 0; for (int i = 0; i < n; i++) { if (!cmp_less_equal(m, abs(cor[i].second))) { double dx = sqrt(m * m - cor[i].second * cor[i].second); if (cmp_less_equal(cor[i].first - dx, cur_pos)) cur_pos = max(cur_pos, cor[i].first + dx); } } if (cmp_less_equal(len, cur_pos)) r = m; else l = m + eps; } cout << setprecision(3) << fixed << r << endl; 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...