Submission #973312

#TimeUsernameProblemLanguageResultExecution timeMemory
973312IdanRosenMobile (BOI12_mobile)C++98
0 / 100
1097 ms62580 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; typedef long double ld; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); ll n, l; cin >> n >> l; vector<pll> arr(n); for (auto &ref: arr) cin >> ref.first >> ref.second; ld start = 0; ld end = 1e12; while (end - start > 1e-4) { ld mid = start + (end - start) / 2; bool check = false; { vector<pair<ld, ld>> ranges(n); for (int i = 0; i < n; i++) { if (mid < arr[i].second) continue; ll center = arr[i].first; ld delta = sqrt(pow(mid, 2) - pow(arr[i].second, 2)); ranges[i] = {center - delta, center + delta}; } std::sort(ranges.begin(), ranges.end()); pair<ld,ld> combined = ranges[0]; for (int i = 1; i < n; i++) { pair<ld,ld>& curr = ranges[i]; if (combined.second < curr.first) { break; } combined.second = curr.second; } if (combined.first <= 0 && l <= combined.second) check = true; else check = false; } if (check) end = mid; else start = mid; } cout << setprecision(6) << start << endl; }
#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...