#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> coords;
double eps = 1e-3;
int N, L;
bool not_works(double val)
{
double curr = 0;
for(int i = 0; i < N; i++)
{
double temp_begin = coords[i].first - sqrt(val*val - coords[i].second*coords[i].second);
double temp_end = coords[i].first + sqrt(val*val - coords[i].second*coords[i].second);
if(temp_begin <= curr)
curr = max(curr, temp_end);
}
if(curr >= L)
return true;
else
return false;
}
int main()
{
cin >> N >> L;
coords.resize(N);
for(int i = 0; i < N; i++)
{
cin >> coords[i].first >> coords[i].second;
}
double lo = 1;
double hi = 1.5e9;
double mid;
while(abs(hi-lo) > eps)
{
mid = (lo + hi)/2;
if(not_works(mid))
hi = mid;
else
lo = mid;
}
cout << fixed << setprecision(4) << lo << "\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
1 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 |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Correct |
3 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
424 KB |
Output is correct |
4 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
416 KB |
Output is correct |
4 |
Correct |
5 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
3 ms |
340 KB |
Output is correct |
4 |
Correct |
5 ms |
444 KB |
Output is correct |
5 |
Correct |
4 ms |
416 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
57 ms |
1464 KB |
Output is correct |
2 |
Correct |
50 ms |
1492 KB |
Output is correct |
3 |
Correct |
34 ms |
1756 KB |
Output is correct |
4 |
Correct |
69 ms |
2628 KB |
Output is correct |
5 |
Correct |
27 ms |
1464 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
51 ms |
1492 KB |
Output is correct |
2 |
Correct |
50 ms |
1396 KB |
Output is correct |
3 |
Correct |
63 ms |
1564 KB |
Output is correct |
4 |
Correct |
67 ms |
2680 KB |
Output is correct |
5 |
Correct |
80 ms |
3020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
44 ms |
1664 KB |
Output is correct |
2 |
Correct |
55 ms |
1492 KB |
Output is correct |
3 |
Correct |
53 ms |
2512 KB |
Output is correct |
4 |
Correct |
100 ms |
3764 KB |
Output is correct |
5 |
Correct |
63 ms |
2612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
1856 KB |
Output is correct |
2 |
Correct |
71 ms |
3268 KB |
Output is correct |
3 |
Correct |
60 ms |
2876 KB |
Output is correct |
4 |
Correct |
101 ms |
3776 KB |
Output is correct |
5 |
Correct |
75 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
73 ms |
1876 KB |
Output is correct |
2 |
Correct |
69 ms |
3276 KB |
Output is correct |
3 |
Correct |
63 ms |
2896 KB |
Output is correct |
4 |
Correct |
98 ms |
3764 KB |
Output is correct |
5 |
Correct |
78 ms |
3012 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
266 ms |
8124 KB |
Output is correct |
2 |
Correct |
360 ms |
15800 KB |
Output is correct |
3 |
Correct |
353 ms |
15288 KB |
Output is correct |
4 |
Correct |
592 ms |
17696 KB |
Output is correct |
5 |
Correct |
393 ms |
15072 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
362 ms |
8112 KB |
Output is correct |
2 |
Correct |
437 ms |
14988 KB |
Output is correct |
3 |
Correct |
316 ms |
13868 KB |
Output is correct |
4 |
Correct |
477 ms |
17500 KB |
Output is correct |
5 |
Correct |
414 ms |
15540 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
303 ms |
9680 KB |
Output is correct |
2 |
Correct |
419 ms |
18900 KB |
Output is correct |
3 |
Correct |
413 ms |
18388 KB |
Output is correct |
4 |
Correct |
609 ms |
21708 KB |
Output is correct |
5 |
Correct |
462 ms |
17604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
450 ms |
9684 KB |
Output is correct |
2 |
Correct |
523 ms |
17736 KB |
Output is correct |
3 |
Correct |
408 ms |
16524 KB |
Output is correct |
4 |
Correct |
599 ms |
21424 KB |
Output is correct |
5 |
Correct |
498 ms |
18412 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
368 ms |
11244 KB |
Output is correct |
2 |
Correct |
505 ms |
22220 KB |
Output is correct |
3 |
Correct |
490 ms |
21348 KB |
Output is correct |
4 |
Correct |
675 ms |
24676 KB |
Output is correct |
5 |
Correct |
547 ms |
20352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
530 ms |
11252 KB |
Output is correct |
2 |
Correct |
607 ms |
20580 KB |
Output is correct |
3 |
Correct |
456 ms |
19640 KB |
Output is correct |
4 |
Correct |
676 ms |
24660 KB |
Output is correct |
5 |
Correct |
571 ms |
21352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
422 ms |
12820 KB |
Output is correct |
2 |
Correct |
579 ms |
25236 KB |
Output is correct |
3 |
Correct |
543 ms |
24460 KB |
Output is correct |
4 |
Correct |
771 ms |
28484 KB |
Output is correct |
5 |
Correct |
633 ms |
23980 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
598 ms |
12828 KB |
Output is correct |
2 |
Correct |
672 ms |
23308 KB |
Output is correct |
3 |
Correct |
515 ms |
22348 KB |
Output is correct |
4 |
Correct |
770 ms |
28308 KB |
Output is correct |
5 |
Correct |
663 ms |
24396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
540 ms |
15956 KB |
Output is correct |
2 |
Correct |
725 ms |
31692 KB |
Output is correct |
3 |
Correct |
699 ms |
30544 KB |
Output is correct |
4 |
Correct |
984 ms |
35172 KB |
Output is correct |
5 |
Correct |
776 ms |
29648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
740 ms |
15956 KB |
Output is correct |
2 |
Correct |
829 ms |
29252 KB |
Output is correct |
3 |
Correct |
653 ms |
28244 KB |
Output is correct |
4 |
Correct |
984 ms |
35424 KB |
Output is correct |
5 |
Correct |
821 ms |
30800 KB |
Output is correct |