#include <bits/stdc++.h>
#define ll long long
#define ld double
#define lid id * 2 + 1
#define rid id * 2 + 2
using namespace std;
const ll mod = 1e9 + 7;
struct coord_t {
ll x, y;
};
bool all(ld rad, ld l, vector<coord_t>& towers) {
ld cur = 0, radsq = rad * rad;
for (auto& t : towers) {
if (t.y > rad) continue;
ld horiz = sqrt(radsq - (t.y * t.y));
if (t.x - horiz > cur) continue;
cur = max(cur, t.x + horiz);
}
return cur >= l;
}
int main() {
// ifstream cin("valleys.in");
// ofstream cout("valleys.out");
ld n, L, i;
ll tx, ty;
cin >> n >> L;
vector<coord_t> towers(n);
for (i = 0; i < n; i++) {
cin >> tx >> ty;
towers[i] = {tx, ty};
}
ld l = 1, r = 1.5e9, tol = 0.001;
while (l < r - tol) {
ld mid = (l + r) / 2;
if (not all(mid, L, towers)) l = mid;
else r = mid;
}
cout << fixed << setprecision(4) << l;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
352 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
352 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
448 KB |
Output is correct |
3 |
Correct |
1 ms |
448 KB |
Output is correct |
4 |
Correct |
2 ms |
356 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
348 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
344 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
564 KB |
Output is correct |
2 |
Correct |
3 ms |
348 KB |
Output is correct |
3 |
Correct |
3 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
448 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
36 ms |
2396 KB |
Output is correct |
2 |
Correct |
39 ms |
2652 KB |
Output is correct |
3 |
Correct |
23 ms |
1884 KB |
Output is correct |
4 |
Correct |
56 ms |
2760 KB |
Output is correct |
5 |
Correct |
19 ms |
1372 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
34 ms |
2392 KB |
Output is correct |
2 |
Correct |
42 ms |
2140 KB |
Output is correct |
3 |
Correct |
52 ms |
2644 KB |
Output is correct |
4 |
Correct |
58 ms |
2652 KB |
Output is correct |
5 |
Correct |
70 ms |
3168 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
2392 KB |
Output is correct |
2 |
Correct |
45 ms |
2868 KB |
Output is correct |
3 |
Correct |
36 ms |
2652 KB |
Output is correct |
4 |
Correct |
84 ms |
3676 KB |
Output is correct |
5 |
Correct |
46 ms |
2648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
3408 KB |
Output is correct |
2 |
Correct |
51 ms |
3156 KB |
Output is correct |
3 |
Correct |
45 ms |
2908 KB |
Output is correct |
4 |
Correct |
85 ms |
3904 KB |
Output is correct |
5 |
Correct |
71 ms |
3136 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
54 ms |
3412 KB |
Output is correct |
2 |
Correct |
52 ms |
3152 KB |
Output is correct |
3 |
Correct |
43 ms |
2896 KB |
Output is correct |
4 |
Correct |
86 ms |
3920 KB |
Output is correct |
5 |
Correct |
64 ms |
3256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
193 ms |
12116 KB |
Output is correct |
2 |
Correct |
275 ms |
15184 KB |
Output is correct |
3 |
Correct |
265 ms |
15440 KB |
Output is correct |
4 |
Correct |
437 ms |
17596 KB |
Output is correct |
5 |
Correct |
351 ms |
15064 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
282 ms |
15904 KB |
Output is correct |
2 |
Correct |
295 ms |
14344 KB |
Output is correct |
3 |
Correct |
212 ms |
13392 KB |
Output is correct |
4 |
Correct |
425 ms |
16780 KB |
Output is correct |
5 |
Correct |
352 ms |
14924 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
227 ms |
14920 KB |
Output is correct |
2 |
Correct |
321 ms |
18368 KB |
Output is correct |
3 |
Correct |
336 ms |
18372 KB |
Output is correct |
4 |
Correct |
526 ms |
21444 KB |
Output is correct |
5 |
Correct |
408 ms |
17740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
338 ms |
18768 KB |
Output is correct |
2 |
Correct |
339 ms |
17484 KB |
Output is correct |
3 |
Correct |
261 ms |
16600 KB |
Output is correct |
4 |
Correct |
513 ms |
21444 KB |
Output is correct |
5 |
Correct |
436 ms |
18508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
273 ms |
16980 KB |
Output is correct |
2 |
Correct |
382 ms |
21328 KB |
Output is correct |
3 |
Correct |
351 ms |
21332 KB |
Output is correct |
4 |
Correct |
601 ms |
24660 KB |
Output is correct |
5 |
Correct |
448 ms |
20324 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
387 ms |
21844 KB |
Output is correct |
2 |
Correct |
403 ms |
20060 KB |
Output is correct |
3 |
Correct |
301 ms |
19028 KB |
Output is correct |
4 |
Correct |
596 ms |
23664 KB |
Output is correct |
5 |
Correct |
488 ms |
20560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
299 ms |
19540 KB |
Output is correct |
2 |
Correct |
419 ms |
24148 KB |
Output is correct |
3 |
Correct |
403 ms |
24404 KB |
Output is correct |
4 |
Correct |
687 ms |
28416 KB |
Output is correct |
5 |
Correct |
539 ms |
24072 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
454 ms |
24912 KB |
Output is correct |
2 |
Correct |
447 ms |
22612 KB |
Output is correct |
3 |
Correct |
348 ms |
21840 KB |
Output is correct |
4 |
Correct |
696 ms |
27008 KB |
Output is correct |
5 |
Correct |
571 ms |
23632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
419 ms |
24020 KB |
Output is correct |
2 |
Correct |
532 ms |
30032 KB |
Output is correct |
3 |
Correct |
532 ms |
30520 KB |
Output is correct |
4 |
Correct |
846 ms |
35156 KB |
Output is correct |
5 |
Correct |
667 ms |
29524 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
556 ms |
28872 KB |
Output is correct |
2 |
Correct |
555 ms |
26200 KB |
Output is correct |
3 |
Correct |
461 ms |
25548 KB |
Output is correct |
4 |
Correct |
867 ms |
30800 KB |
Output is correct |
5 |
Correct |
754 ms |
30656 KB |
Output is correct |