Submission #698215

#TimeUsernameProblemLanguageResultExecution timeMemory
698215randmacMobile (BOI12_mobile)C++14
12 / 100
276 ms8500 KiB
#include <algorithm> #include <iostream> #include <cstdio> #include <vector> #include <set> #include <queue> #include <math.h> #include <iomanip> using namespace std; // https://oj.uz/problem/view/BOI12_mobile int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); // freopen("mobile.in", "r", stdin); // freopen("mobile.out", "w", stdout); int N, L; cin >> N >> L; vector<pair<int, int>> a(N); for (int i = 0; i < N; i++) { cin >> a[i].first >> a[i].second; } // double ans = -1; // for (int i = 0; i < b.size() - 1; i++) { // int x_sum = b[i].first + b[i + 1].first; // int x_diff = b[i + 1].first - b[i].first; // double y_squared = (b[i + 1].second + b[i].second) * (b[i + 1].second - b[i].second); // double x_0 = ( y_squared / x_diff + x_sum) / 2; // double distance = (b[i].first - x_0) * (b[i].first - x_0) + b[i].second * b[i].second; // ans = max(ans, distance); // } double low = 1, high = 1.5e9; while (high - low > 1e-3) { double mid = low + (high - low) / 2, curr = 0; for (int i = 0; i < N; i++) { double delta = sqrt(mid * mid - a[i].second * a[i].second); double left = a[i].first - delta, right = a[i].first + delta; if (left <= curr) curr = max(curr, right); } if (curr >= L) high = mid; else low = mid; } // cout << sqrt(ans) << setprecision(4) << endl; cout << fixed << setprecision(4) << low << endl; }
#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...