#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 && 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 |
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 |
7 ms |
2396 KB |
Output is correct |
2 |
Correct |
7 ms |
2648 KB |
Output is correct |
3 |
Correct |
6 ms |
2772 KB |
Output is correct |
4 |
Correct |
8 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
2648 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2652 KB |
Output is correct |
2 |
Correct |
7 ms |
2652 KB |
Output is correct |
3 |
Correct |
6 ms |
2392 KB |
Output is correct |
4 |
Incorrect |
7 ms |
2652 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
83 ms |
7584 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
89 ms |
7544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
102 ms |
7464 KB |
Output is correct |
2 |
Correct |
98 ms |
7772 KB |
Output is correct |
3 |
Correct |
92 ms |
7768 KB |
Output is correct |
4 |
Incorrect |
147 ms |
8732 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
121 ms |
8284 KB |
Output is correct |
2 |
Correct |
121 ms |
8280 KB |
Output is correct |
3 |
Correct |
113 ms |
7820 KB |
Output is correct |
4 |
Incorrect |
147 ms |
8752 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
118 ms |
8272 KB |
Output is correct |
2 |
Correct |
122 ms |
8440 KB |
Output is correct |
3 |
Correct |
114 ms |
7828 KB |
Output is correct |
4 |
Incorrect |
150 ms |
8532 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
602 ms |
23392 KB |
Output is correct |
2 |
Correct |
615 ms |
26828 KB |
Output is correct |
3 |
Correct |
601 ms |
26332 KB |
Output is correct |
4 |
Incorrect |
788 ms |
28688 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
631 ms |
27272 KB |
Output is correct |
2 |
Incorrect |
554 ms |
25600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
715 ms |
28528 KB |
Output is correct |
2 |
Correct |
733 ms |
32492 KB |
Output is correct |
3 |
Correct |
728 ms |
31912 KB |
Output is correct |
4 |
Incorrect |
702 ms |
35112 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
739 ms |
32848 KB |
Output is correct |
2 |
Correct |
662 ms |
31060 KB |
Output is correct |
3 |
Correct |
665 ms |
29944 KB |
Output is correct |
4 |
Incorrect |
879 ms |
34952 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
833 ms |
31308 KB |
Output is correct |
2 |
Correct |
851 ms |
36108 KB |
Output is correct |
3 |
Correct |
846 ms |
35460 KB |
Output is correct |
4 |
Execution timed out |
1033 ms |
38740 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
884 ms |
36744 KB |
Output is correct |
2 |
Correct |
766 ms |
34644 KB |
Output is correct |
3 |
Correct |
779 ms |
33856 KB |
Output is correct |
4 |
Incorrect |
988 ms |
38684 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
944 ms |
36456 KB |
Output is correct |
2 |
Correct |
978 ms |
41916 KB |
Output is correct |
3 |
Correct |
984 ms |
41040 KB |
Output is correct |
4 |
Execution timed out |
1055 ms |
44884 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
993 ms |
42544 KB |
Output is correct |
2 |
Incorrect |
900 ms |
40016 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1006 ms |
40276 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1038 ms |
48212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |