Submission #1079314

#TimeUsernameProblemLanguageResultExecution timeMemory
1079314EmmaXIIMobile (BOI12_mobile)C++17
31 / 100
1059 ms64772 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; double L; cin >> N >> L; vector<double> X(N); vector<double> 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*r - y*y); }; auto can_do = [&](double R) { vector<pair<double, double>> ivals; for (int i=0;i<N;i++) { double hw = get_hw(Y[i], R); if (hw < 0) continue; ivals.push_back({X[i] - hw, X[i] + hw}); } sort(all(ivals)); double progress = 0.; for (auto [l, r] : ivals) { if (l > progress) return false; progress = max(progress, r); } return progress >= L; }; double lo = 0; double hi = L + abs(X[0]) + abs(Y[0]); while (hi - lo > 1e-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...