Submission #1079723

#TimeUsernameProblemLanguageResultExecution timeMemory
1079723EmmaXIIMobile (BOI12_mobile)C++17
0 / 100
286 ms31592 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; using vi = vector<int>; using vvi = vector<vector<int>>; using vll = vector<ll>; using vvll = vector<vector<ll>>; #define all(x) x.begin(), x.end() int main() { std::ios::sync_with_stdio(false); std::cin.tie(NULL); int N; ll L; cin >> N >> L; vector<ll> X(N); vector<ll> Y(N); for (int i=0;i<N;i++) cin >> X[i] >> Y[i]; auto get_hw = [&](double y, double r) { if (abs(y) > r) return -1.0; return sqrt((r-y) * (r+y)); }; auto can_do = [&](double R) { double progress = 0.; for (int i=0;i<N;i++) { double hw = get_hw((double)Y[i], R); if (hw < 0) continue; double l = (double)X[i] - hw; double r = (double)X[i] + hw; if (l < progress) progress = r; if (progress >= (double)L) return true; } return false; }; double lo = 0; ll lhi = L + abs(X[0]) + abs(Y[0]); lhi = lhi*lhi; for (int i=0;i<N;i++) { ll nhi = max( X[i]*X[i] + Y[i]*Y[i], (X[i]-L)*(X[i]-L) + Y[i]*Y[i] ); lhi = min(nhi, lhi); } double hi = sqrt(lhi); while (hi - lo > 5e-4) { double mid = (lo + hi) / 2; if (can_do(mid)) hi = mid; else lo = mid; } cout << setprecision(10); cout << lo << endl; 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...