#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
struct P {
ld x, y;
};
vector<P> a;
int n, L;
bool ok(ld r) {
ld curr = 0;
for(int i = 0; i < n; i++) {
if (r * r < a[i].y * a[i].y) continue;
ld sol = sqrt(r * r - a[i].y * a[i].y);
ld left = max((ld) 0, a[i].x - sol);
ld right = min((ld) L, a[i].x + sol);
if (left <= curr) {
curr = max(curr, right);
}
}
return curr >= L;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> L;
a.resize(n);
for(auto& i : a) {
cin >> i.x >> i.y;
}
double l = 0, r = 1e9;
double ans = r;
for(int rep = 0; rep < 40; rep++) {
double mid = (l + r) / 2;
if (rep == 0) mid = 1;
else if (r > 1) mid = sqrt((long double) l * r);
if (ok(mid)) {
r = mid;
ans = mid;
}
else {
l = mid;
}
}
cout << fixed << setprecision(6) << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
4 ms |
404 KB |
Output is correct |
3 |
Correct |
2 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
332 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
6 ms |
460 KB |
Output is correct |
3 |
Correct |
5 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
6 ms |
460 KB |
Output is correct |
3 |
Correct |
5 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
460 KB |
Output is correct |
2 |
Correct |
6 ms |
460 KB |
Output is correct |
3 |
Correct |
5 ms |
460 KB |
Output is correct |
4 |
Correct |
6 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
78 ms |
2636 KB |
Output is correct |
2 |
Correct |
94 ms |
2636 KB |
Output is correct |
3 |
Correct |
57 ms |
1996 KB |
Output is correct |
4 |
Correct |
61 ms |
2636 KB |
Output is correct |
5 |
Correct |
34 ms |
1836 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
56 ms |
2764 KB |
Output is correct |
2 |
Correct |
53 ms |
2508 KB |
Output is correct |
3 |
Correct |
60 ms |
2764 KB |
Output is correct |
4 |
Correct |
64 ms |
2764 KB |
Output is correct |
5 |
Correct |
73 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
3020 KB |
Output is correct |
2 |
Correct |
98 ms |
2892 KB |
Output is correct |
3 |
Correct |
88 ms |
2892 KB |
Output is correct |
4 |
Correct |
86 ms |
3404 KB |
Output is correct |
5 |
Correct |
63 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
127 ms |
3404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
122 ms |
3404 KB |
Output is correct |
2 |
Correct |
125 ms |
3404 KB |
Output is correct |
3 |
Correct |
107 ms |
3352 KB |
Output is correct |
4 |
Correct |
86 ms |
3404 KB |
Output is correct |
5 |
Correct |
81 ms |
3404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
576 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
606 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
691 ms |
19020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
735 ms |
19100 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
814 ms |
22100 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
861 ms |
22220 KB |
Output is correct |
2 |
Correct |
730 ms |
22220 KB |
Output is correct |
3 |
Correct |
719 ms |
22220 KB |
Output is correct |
4 |
Correct |
596 ms |
22212 KB |
Output is correct |
5 |
Correct |
537 ms |
22204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
922 ms |
25284 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
999 ms |
25292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1082 ms |
31620 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
31636 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |