Submission #1056885

#TimeUsernameProblemLanguageResultExecution timeMemory
1056885TimAniMobile (BOI12_mobile)C++17
100 / 100
487 ms8024 KiB
#include <bits/stdc++.h> #define long long long using namespace std; const double eps = 1E-4; const int N = (int) 1E6; int n, k; int x[N], y[N]; bool valid(double a) { double t = 0; for (int i = 0; i < n; i++) { if (a < y[i]) { continue; } double l = x[i] - sqrt(1.0 * a * a - 1.0 * y[i] * y[i]); double r = x[i] + sqrt(1.0 * a * a - 1.0 * y[i] * y[i]); if (l <= t && r >= t) { t = r; } } return t >= k; } void solve() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; } double l = 0, r = 4E9; while(r - l > eps) { double R = (r + l) / 2; if(valid(R)) { r = R; } else { l = R; } } cout << fixed << setprecision(-log10(eps)) << r << endl; } int main() { cin.tie(0)->sync_with_stdio(0); double T = 1; //cin >> T; while(T--) solve(); 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...