Submission #973117

#TimeUsernameProblemLanguageResultExecution timeMemory
973117njoopMobile (BOI12_mobile)C++17
0 / 100
1071 ms33524 KiB
#include <bits/stdc++.h> #define pi pair<double, double> using namespace std; double x, y, L, l=0, r=1e9, mid, de, cov; pi arr[1000010]; vector<pi> in; int n; bool solve(double rad) { in.clear(); cov = 0; for(int i=1; i<=n; i++) { de = pow(rad, 2) - pow(abs(arr[i].second), 2); de = sqrt(de); if(de < 0) continue; in.push_back({arr[i].first-de, arr[i].first+de}); } sort(in.begin(), in.end()); for(auto i: in) { if(i.first > cov) return 0; cov = max(cov, i.second); if(cov >= L) return 1; } return 0; } int main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> L; for(int i=1; i<=n; i++) { cin >> arr[i].first >> arr[i].second; } while(l+0.00001 < r) { mid = (l+r)/2; if(solve(mid)) { r = mid; } else { l = mid + 0.001; } } cout << fixed << setprecision(6) << l; 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...