#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 = 0.000000000000001, 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 |
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 |
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 |
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 |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
7 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 |
7 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 |
76 ms |
2636 KB |
Output is correct |
2 |
Correct |
91 ms |
2636 KB |
Output is correct |
3 |
Correct |
55 ms |
1996 KB |
Output is correct |
4 |
Correct |
59 ms |
2636 KB |
Output is correct |
5 |
Correct |
35 ms |
1868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
2764 KB |
Output is correct |
2 |
Correct |
50 ms |
2508 KB |
Output is correct |
3 |
Correct |
73 ms |
2764 KB |
Output is correct |
4 |
Correct |
63 ms |
2764 KB |
Output is correct |
5 |
Correct |
71 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
105 ms |
3020 KB |
Output is correct |
2 |
Correct |
99 ms |
2892 KB |
Output is correct |
3 |
Correct |
89 ms |
2892 KB |
Output is correct |
4 |
Correct |
93 ms |
3404 KB |
Output is correct |
5 |
Correct |
60 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
120 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 |
130 ms |
3404 KB |
Output is correct |
3 |
Correct |
99 ms |
3404 KB |
Output is correct |
4 |
Correct |
90 ms |
3404 KB |
Output is correct |
5 |
Correct |
74 ms |
3404 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
570 ms |
15864 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
616 ms |
15948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
693 ms |
19020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
737 ms |
19020 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
801 ms |
22220 KB |
Output is correct |
2 |
Correct |
840 ms |
22220 KB |
Output is correct |
3 |
Correct |
836 ms |
22220 KB |
Output is correct |
4 |
Correct |
604 ms |
22220 KB |
Output is correct |
5 |
Correct |
550 ms |
22220 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
851 ms |
22220 KB |
Output is correct |
2 |
Correct |
735 ms |
22164 KB |
Output is correct |
3 |
Correct |
734 ms |
22212 KB |
Output is correct |
4 |
Correct |
605 ms |
22220 KB |
Output is correct |
5 |
Correct |
547 ms |
22144 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
909 ms |
25292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
992 ms |
25292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1088 ms |
31564 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1091 ms |
31612 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |