#include<bits/stdc++.h>
const int MaxN = 1e6 + 10;
const long double Eps = 1e-3;
const long double MaxV = 1e18;
int n;
long double length,x[MaxN + 1],y[MaxN + 1];
void readData(){
std::cin >> n >> length;
for(int i = 1;i <= n;++i){
std::cin >> x[i] >> y[i];
}
}
bool f(long double mid){
long double l = 0,r = 0;
for(int i = 1;i <= n;++i){
if(mid < y[i]){
continue;
}
long double distance = sqrt(mid * mid - y[i] * y[i]);
if(x[i] - distance <= r && x[i] + distance >= l){
l = std::min(l,x[i] - distance);
r = std::max(r,x[i] + distance);
}
}
return (l <= 0 && r >= length);
}
long double solve(long double lo,long double hi){
while(hi - lo > Eps){
long double mid = (lo + hi) / 2;
if(f(mid)){
hi = mid;
}else{
lo = mid;
}
// std::cerr << mid << "\n";
}
return hi;
}
int main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);std::cout.tie(nullptr);
readData();
std::cout << std::fixed << std::setprecision(8) << solve(0,MaxV * 2);
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2648 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
3 ms |
2396 KB |
Output is correct |
4 |
Correct |
3 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2396 KB |
Output is correct |
2 |
Correct |
5 ms |
2396 KB |
Output is correct |
3 |
Correct |
5 ms |
2392 KB |
Output is correct |
4 |
Correct |
6 ms |
2608 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2396 KB |
Output is correct |
2 |
Correct |
6 ms |
2396 KB |
Output is correct |
3 |
Correct |
5 ms |
2604 KB |
Output is correct |
4 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2392 KB |
Output is correct |
2 |
Correct |
6 ms |
2396 KB |
Output is correct |
3 |
Correct |
5 ms |
2396 KB |
Output is correct |
4 |
Correct |
6 ms |
2600 KB |
Output is correct |
5 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
70 ms |
6812 KB |
Output is correct |
2 |
Correct |
76 ms |
6748 KB |
Output is correct |
3 |
Correct |
50 ms |
4700 KB |
Output is correct |
4 |
Correct |
89 ms |
6748 KB |
Output is correct |
5 |
Correct |
50 ms |
4696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
80 ms |
6792 KB |
Output is correct |
2 |
Correct |
80 ms |
6744 KB |
Output is correct |
3 |
Correct |
93 ms |
6788 KB |
Output is correct |
4 |
Correct |
93 ms |
6736 KB |
Output is correct |
5 |
Correct |
104 ms |
6792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
91 ms |
6736 KB |
Output is correct |
2 |
Correct |
79 ms |
6800 KB |
Output is correct |
3 |
Correct |
79 ms |
6740 KB |
Output is correct |
4 |
Correct |
129 ms |
6544 KB |
Output is correct |
5 |
Correct |
96 ms |
6788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
97 ms |
6788 KB |
Output is correct |
2 |
Correct |
98 ms |
7000 KB |
Output is correct |
3 |
Correct |
92 ms |
6784 KB |
Output is correct |
4 |
Correct |
123 ms |
6788 KB |
Output is correct |
5 |
Correct |
118 ms |
6788 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
99 ms |
6748 KB |
Output is correct |
2 |
Correct |
98 ms |
6544 KB |
Output is correct |
3 |
Correct |
92 ms |
6808 KB |
Output is correct |
4 |
Correct |
133 ms |
6788 KB |
Output is correct |
5 |
Correct |
115 ms |
6796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
520 ms |
19104 KB |
Output is correct |
2 |
Correct |
483 ms |
19028 KB |
Output is correct |
3 |
Correct |
500 ms |
19104 KB |
Output is correct |
4 |
Correct |
630 ms |
19104 KB |
Output is correct |
5 |
Correct |
591 ms |
19096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
511 ms |
19088 KB |
Output is correct |
2 |
Correct |
532 ms |
19080 KB |
Output is correct |
3 |
Correct |
454 ms |
19100 KB |
Output is correct |
4 |
Correct |
621 ms |
19100 KB |
Output is correct |
5 |
Correct |
592 ms |
19100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
644 ms |
23212 KB |
Output is correct |
2 |
Correct |
590 ms |
23456 KB |
Output is correct |
3 |
Correct |
581 ms |
23208 KB |
Output is correct |
4 |
Correct |
752 ms |
23200 KB |
Output is correct |
5 |
Correct |
692 ms |
23208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
625 ms |
23204 KB |
Output is correct |
2 |
Correct |
586 ms |
23428 KB |
Output is correct |
3 |
Correct |
561 ms |
23124 KB |
Output is correct |
4 |
Correct |
741 ms |
23444 KB |
Output is correct |
5 |
Correct |
708 ms |
23428 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
731 ms |
25256 KB |
Output is correct |
2 |
Correct |
688 ms |
25252 KB |
Output is correct |
3 |
Correct |
714 ms |
25504 KB |
Output is correct |
4 |
Correct |
871 ms |
25480 KB |
Output is correct |
5 |
Correct |
797 ms |
25256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
728 ms |
25244 KB |
Output is correct |
2 |
Correct |
669 ms |
25256 KB |
Output is correct |
3 |
Correct |
676 ms |
25480 KB |
Output is correct |
4 |
Correct |
894 ms |
25256 KB |
Output is correct |
5 |
Correct |
829 ms |
25260 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
844 ms |
29604 KB |
Output is correct |
2 |
Correct |
789 ms |
29360 KB |
Output is correct |
3 |
Correct |
791 ms |
29364 KB |
Output is correct |
4 |
Correct |
991 ms |
29360 KB |
Output is correct |
5 |
Correct |
938 ms |
29364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
800 ms |
29520 KB |
Output is correct |
2 |
Correct |
749 ms |
29356 KB |
Output is correct |
3 |
Correct |
744 ms |
29520 KB |
Output is correct |
4 |
Correct |
983 ms |
29360 KB |
Output is correct |
5 |
Correct |
970 ms |
29364 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1026 ms |
32256 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1036 ms |
31760 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |