Submission #1132521

#TimeUsernameProblemLanguageResultExecution timeMemory
1132521vedeshrayMobile (BOI12_mobile)C++20
8 / 100
185 ms15944 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ios::sync_with_stdio(0); cin.tie(0); ll n, l; cin >> n >> l; vector<pair<ll, ll>> stations(n); for (auto &[x, y] : stations) {cin >> x >> y;} double minRad = 1, maxRad = 2e9; // maxRad has to be enough to reach the ends of the highway while (minRad <= maxRad - 1e-3) { // we have a 1e-3 (.001) leeway on the answer double midRad = (minRad + maxRad) / 2; double currPoint = 0; // current uncovered point on the highway for (auto [x, y] : stations) { double b = sqrt(midRad * midRad - y * y); // b = dist from the x coord of the station to the bound of the station's circle intersection on the highway. double segLeft = x - b, segRight = x + b; if (segLeft <= currPoint) {currPoint = max(currPoint, segRight);} } if (currPoint >= l) {maxRad = midRad;} // if all the highway has been covered else {minRad = midRad;} // means a point was far away enough to not be covered } cout << minRad << setprecision(6) << '\n'; }
#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...