#include<bits/stdc++.h>
const int MaxN = 1e6 + 10;
const long double Eps = 1e-5;
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 |
2 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 |
2392 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 |
2648 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2548 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
3 ms |
2392 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 |
2392 KB |
Output is correct |
3 |
Correct |
5 ms |
2396 KB |
Output is correct |
4 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2392 KB |
Output is correct |
2 |
Correct |
6 ms |
2392 KB |
Output is correct |
3 |
Correct |
5 ms |
2396 KB |
Output is correct |
4 |
Correct |
6 ms |
2396 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 |
2556 KB |
Output is correct |
4 |
Correct |
7 ms |
2604 KB |
Output is correct |
5 |
Correct |
6 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
75 ms |
6792 KB |
Output is correct |
2 |
Correct |
78 ms |
6732 KB |
Output is correct |
3 |
Correct |
52 ms |
4740 KB |
Output is correct |
4 |
Correct |
96 ms |
6740 KB |
Output is correct |
5 |
Correct |
52 ms |
4744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
85 ms |
6744 KB |
Output is correct |
2 |
Correct |
87 ms |
6748 KB |
Output is correct |
3 |
Correct |
101 ms |
6748 KB |
Output is correct |
4 |
Correct |
100 ms |
7004 KB |
Output is correct |
5 |
Correct |
113 ms |
6792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
100 ms |
6788 KB |
Output is correct |
2 |
Correct |
87 ms |
6748 KB |
Output is correct |
3 |
Correct |
80 ms |
6792 KB |
Output is correct |
4 |
Correct |
132 ms |
6788 KB |
Output is correct |
5 |
Correct |
112 ms |
6744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
103 ms |
6544 KB |
Output is correct |
2 |
Correct |
109 ms |
6740 KB |
Output is correct |
3 |
Correct |
96 ms |
6744 KB |
Output is correct |
4 |
Correct |
139 ms |
6796 KB |
Output is correct |
5 |
Correct |
127 ms |
6740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
104 ms |
6792 KB |
Output is correct |
2 |
Correct |
102 ms |
6808 KB |
Output is correct |
3 |
Correct |
100 ms |
6748 KB |
Output is correct |
4 |
Correct |
133 ms |
6792 KB |
Output is correct |
5 |
Correct |
129 ms |
6548 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
553 ms |
19332 KB |
Output is correct |
2 |
Correct |
525 ms |
19028 KB |
Output is correct |
3 |
Correct |
555 ms |
19084 KB |
Output is correct |
4 |
Correct |
668 ms |
19100 KB |
Output is correct |
5 |
Correct |
626 ms |
19328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
527 ms |
19088 KB |
Output is correct |
2 |
Correct |
516 ms |
19100 KB |
Output is correct |
3 |
Correct |
487 ms |
19100 KB |
Output is correct |
4 |
Correct |
662 ms |
19028 KB |
Output is correct |
5 |
Correct |
676 ms |
19096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
674 ms |
23180 KB |
Output is correct |
2 |
Correct |
620 ms |
23124 KB |
Output is correct |
3 |
Correct |
620 ms |
23380 KB |
Output is correct |
4 |
Correct |
808 ms |
23208 KB |
Output is correct |
5 |
Correct |
761 ms |
23444 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
646 ms |
23436 KB |
Output is correct |
2 |
Correct |
615 ms |
23380 KB |
Output is correct |
3 |
Correct |
586 ms |
23208 KB |
Output is correct |
4 |
Correct |
792 ms |
23380 KB |
Output is correct |
5 |
Correct |
759 ms |
23208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
786 ms |
25256 KB |
Output is correct |
2 |
Correct |
720 ms |
25260 KB |
Output is correct |
3 |
Correct |
731 ms |
25260 KB |
Output is correct |
4 |
Correct |
971 ms |
25216 KB |
Output is correct |
5 |
Correct |
875 ms |
25424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
771 ms |
25236 KB |
Output is correct |
2 |
Correct |
705 ms |
25492 KB |
Output is correct |
3 |
Correct |
695 ms |
25172 KB |
Output is correct |
4 |
Correct |
945 ms |
25252 KB |
Output is correct |
5 |
Correct |
934 ms |
25504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
888 ms |
29520 KB |
Output is correct |
2 |
Correct |
850 ms |
29572 KB |
Output is correct |
3 |
Correct |
839 ms |
29524 KB |
Output is correct |
4 |
Execution timed out |
1006 ms |
29552 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
838 ms |
29268 KB |
Output is correct |
2 |
Correct |
789 ms |
29324 KB |
Output is correct |
3 |
Correct |
803 ms |
29268 KB |
Output is correct |
4 |
Execution timed out |
1034 ms |
29344 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1053 ms |
31568 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1030 ms |
31828 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |