#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;
}
ld l = 1, r = 1e9;
ld ans = r;
for(int rep = 0; rep < 40; rep++) {
ld mid = sqrt(l * r);
// ld mid = (l + r) / 2;
// cout << mid << "\n";
if (ok(mid)) {
r = mid;
ans = mid;
}
else {
l = mid;
}
}
cout << fixed << setprecision(6) << ans << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
316 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 |
3 ms |
332 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 |
5 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 |
5 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 |
6 ms |
460 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 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 |
5 ms |
460 KB |
Output is correct |
5 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
79 ms |
2636 KB |
Output is correct |
2 |
Correct |
92 ms |
2636 KB |
Output is correct |
3 |
Correct |
61 ms |
1996 KB |
Output is correct |
4 |
Correct |
59 ms |
2636 KB |
Output is correct |
5 |
Correct |
33 ms |
1868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
2764 KB |
Output is correct |
2 |
Correct |
51 ms |
2508 KB |
Output is correct |
3 |
Correct |
59 ms |
2764 KB |
Output is correct |
4 |
Correct |
61 ms |
2764 KB |
Output is correct |
5 |
Correct |
75 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
99 ms |
3020 KB |
Output is correct |
2 |
Correct |
98 ms |
2892 KB |
Output is correct |
3 |
Correct |
86 ms |
2892 KB |
Output is correct |
4 |
Correct |
86 ms |
3404 KB |
Output is correct |
5 |
Correct |
61 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
121 ms |
3404 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
3404 KB |
Output is correct |
2 |
Correct |
120 ms |
3404 KB |
Output is correct |
3 |
Correct |
101 ms |
3404 KB |
Output is correct |
4 |
Correct |
87 ms |
3404 KB |
Output is correct |
5 |
Correct |
73 ms |
3404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
574 ms |
15928 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
605 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
682 ms |
19020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
737 ms |
19100 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
810 ms |
22220 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
842 ms |
22220 KB |
Output is correct |
2 |
Correct |
732 ms |
22220 KB |
Output is correct |
3 |
Correct |
722 ms |
22220 KB |
Output is correct |
4 |
Correct |
594 ms |
22220 KB |
Output is correct |
5 |
Correct |
530 ms |
22220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
917 ms |
25292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
970 ms |
25280 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1057 ms |
31564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1094 ms |
31548 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |