#include<bits/stdc++.h>
const int MaxN = 1e6 + 10;
const long double Eps = 1e-6;
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 = 1e10,r = 1e10;
bool found = false;
for(int i = 1;i <= n;++i){
if(mid < y[i]){
continue;
}
long double distance = sqrt(mid * mid - y[i] * y[i]);
if(!found){
found = true;
l = x[i] - distance;
r = x[i] + distance;
}else{
if(r >= x[i] - distance){
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 |
2392 KB |
Output is correct |
4 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2396 KB |
Output is correct |
2 |
Correct |
6 ms |
2392 KB |
Output is correct |
3 |
Correct |
6 ms |
2600 KB |
Output is correct |
4 |
Correct |
8 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2392 KB |
Output is correct |
2 |
Correct |
8 ms |
2396 KB |
Output is correct |
3 |
Correct |
6 ms |
2396 KB |
Output is correct |
4 |
Incorrect |
7 ms |
2396 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
77 ms |
6736 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
97 ms |
6744 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
108 ms |
7004 KB |
Output is correct |
2 |
Correct |
94 ms |
6804 KB |
Output is correct |
3 |
Correct |
88 ms |
6748 KB |
Output is correct |
4 |
Incorrect |
144 ms |
6784 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
116 ms |
6996 KB |
Output is correct |
2 |
Correct |
114 ms |
6540 KB |
Output is correct |
3 |
Correct |
108 ms |
6744 KB |
Output is correct |
4 |
Incorrect |
139 ms |
6788 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
113 ms |
7004 KB |
Output is correct |
2 |
Correct |
116 ms |
6792 KB |
Output is correct |
3 |
Correct |
105 ms |
6748 KB |
Output is correct |
4 |
Incorrect |
146 ms |
6544 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
559 ms |
19104 KB |
Output is correct |
2 |
Correct |
598 ms |
19100 KB |
Output is correct |
3 |
Correct |
678 ms |
19076 KB |
Output is correct |
4 |
Incorrect |
776 ms |
19024 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
589 ms |
19284 KB |
Output is correct |
2 |
Incorrect |
583 ms |
19352 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
662 ms |
23204 KB |
Output is correct |
2 |
Correct |
688 ms |
23452 KB |
Output is correct |
3 |
Correct |
697 ms |
23376 KB |
Output is correct |
4 |
Incorrect |
666 ms |
23176 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
692 ms |
23204 KB |
Output is correct |
2 |
Correct |
626 ms |
23120 KB |
Output is correct |
3 |
Correct |
622 ms |
23204 KB |
Output is correct |
4 |
Incorrect |
850 ms |
23204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
774 ms |
25256 KB |
Output is correct |
2 |
Correct |
820 ms |
25172 KB |
Output is correct |
3 |
Correct |
826 ms |
25256 KB |
Output is correct |
4 |
Execution timed out |
1006 ms |
25428 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
815 ms |
25508 KB |
Output is correct |
2 |
Correct |
734 ms |
25472 KB |
Output is correct |
3 |
Correct |
741 ms |
25428 KB |
Output is correct |
4 |
Incorrect |
957 ms |
25260 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
913 ms |
29364 KB |
Output is correct |
2 |
Correct |
922 ms |
29364 KB |
Output is correct |
3 |
Correct |
915 ms |
29364 KB |
Output is correct |
4 |
Execution timed out |
1070 ms |
29268 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
932 ms |
29608 KB |
Output is correct |
2 |
Incorrect |
813 ms |
29520 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1049 ms |
31632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1066 ms |
31572 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |