#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 + 1e-04;
}
// cout << sqrt(ans) << setprecision(4) << endl;
cout << fixed << setprecision(4) << low << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
340 KB |
Output is correct |
3 |
Correct |
2 ms |
340 KB |
Output is correct |
4 |
Incorrect |
3 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
3 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
852 KB |
Output is correct |
2 |
Incorrect |
20 ms |
852 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
952 KB |
Output is correct |
2 |
Correct |
28 ms |
852 KB |
Output is correct |
3 |
Incorrect |
39 ms |
952 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
980 KB |
Output is correct |
2 |
Incorrect |
23 ms |
852 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
1116 KB |
Output is correct |
2 |
Incorrect |
28 ms |
1108 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
1108 KB |
Output is correct |
2 |
Incorrect |
33 ms |
1108 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
140 ms |
4228 KB |
Output is correct |
2 |
Incorrect |
139 ms |
4228 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
152 ms |
4224 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
139 ms |
5004 KB |
Output is correct |
2 |
Incorrect |
182 ms |
5016 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
174 ms |
5012 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
204 ms |
5836 KB |
Output is correct |
2 |
Incorrect |
193 ms |
5800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
215 ms |
5796 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
6572 KB |
Output is correct |
2 |
Incorrect |
238 ms |
6572 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
226 ms |
6580 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
248 ms |
8148 KB |
Output is correct |
2 |
Incorrect |
285 ms |
8140 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
300 ms |
8148 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |