#include <bits/stdc++.h>
using namespace std;
vector<pair<double, double>> pts;
int n;
double L;
bool works(double d){
// whether a radius of d is enough to intersect all the circles
double currDistCovered = 0.0;
for(int i = 0; i < n; i++){
// find the segment covered by ith circle on the highway
// radius^2 = yi^2 + dist^2
double dist = sqrt(d*d - pts[i].second*pts[i].second);
double start = pts[i].first - dist;
double end = pts[i].first + dist;
if(start <= currDistCovered){
currDistCovered = max(currDistCovered, end);
}
}
return currDistCovered >= L;
}
int main() {
cin >> n >> L;
pts.resize(n);
for(int i = 0; i < n; i++) cin >> pts[i].first >> pts[i].second;
double good = 1.5e9;
double bad = -1.0;
for(int i = 0; i < 40; i++){
double mid = bad + (good - bad)/2;
//cout << fixed << setprecision(6) << i << " " << mid <<"\n" ;
if(works(mid)){
good = mid;
} else {
bad = mid;
}
}
cout << fixed << setprecision(6) << good;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
292 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 |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
340 KB |
Output is correct |
2 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Incorrect |
5 ms |
444 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
340 KB |
Output is correct |
2 |
Incorrect |
6 ms |
340 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
66 ms |
1464 KB |
Output is correct |
2 |
Correct |
76 ms |
2264 KB |
Output is correct |
3 |
Incorrect |
43 ms |
1640 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
59 ms |
1492 KB |
Output is correct |
2 |
Incorrect |
60 ms |
1996 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
59 ms |
1620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
102 ms |
1856 KB |
Output is correct |
2 |
Incorrect |
89 ms |
2620 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
92 ms |
1748 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
347 ms |
8120 KB |
Output is correct |
2 |
Correct |
465 ms |
8888 KB |
Output is correct |
3 |
Correct |
453 ms |
11704 KB |
Output is correct |
4 |
Correct |
549 ms |
11704 KB |
Output is correct |
5 |
Correct |
479 ms |
11700 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
484 ms |
8124 KB |
Output is correct |
2 |
Correct |
503 ms |
11660 KB |
Output is correct |
3 |
Correct |
393 ms |
11708 KB |
Output is correct |
4 |
Correct |
554 ms |
11672 KB |
Output is correct |
5 |
Correct |
484 ms |
11652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
417 ms |
9684 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
572 ms |
9684 KB |
Output is correct |
2 |
Incorrect |
587 ms |
13324 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
486 ms |
11248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
665 ms |
11252 KB |
Output is correct |
2 |
Incorrect |
672 ms |
14920 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
576 ms |
12820 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
758 ms |
12812 KB |
Output is correct |
2 |
Correct |
781 ms |
16400 KB |
Output is correct |
3 |
Incorrect |
648 ms |
16292 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
696 ms |
15956 KB |
Output is correct |
2 |
Correct |
923 ms |
16828 KB |
Output is correct |
3 |
Correct |
886 ms |
19296 KB |
Output is correct |
4 |
Execution timed out |
1070 ms |
16044 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
939 ms |
15956 KB |
Output is correct |
2 |
Correct |
942 ms |
29128 KB |
Output is correct |
3 |
Correct |
864 ms |
28252 KB |
Output is correct |
4 |
Execution timed out |
1075 ms |
35300 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |