Submission #1116511

#TimeUsernameProblemLanguageResultExecution timeMemory
1116511vomanosMobile (BOI12_mobile)C++14
100 / 100
824 ms35412 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> using namespace std; #define ll long long #define pdd pair<double, double> double dist2(pdd a, pdd b) { return (a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second); } int main() { int N; ll L; cin >> N >> L; pdd s[N]; for (int i = 0; i < N; i++) cin >> s[i].first >> s[i].second; double low = 0, high = 1e12; // double low = 6, high = 6.01; while (high - low > 0.000001) { double mid = low + (high - low) / 2; double x = 0; for (int i = 0; i < N; i++) { if (dist2({x, 0}, {s[i]}) > mid*mid) continue; // let x = s[i].first, y = s[i].second; // (x + d)^2 + y^2 = r^2 // x + d = sqrt(r^2 - y^2) //d = sqrt(r^2 - y^2) x = s[i].first + sqrt(mid*mid - s[i].second * s[i].second); } // cout << mid << " " << x << endl; if (x >= L) high = mid; else low = mid; } cout << fixed << setprecision(10) << high; }
#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...