#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
int n;
ld L;
cin >> n >> L;
vector <pair<ld,ld>> pts(n);
for(int i=0; i<n; i++){
cin >> pts[i].first >> pts[i].second;
}
const ld EPS = 1e-9;
ld l=0, r=1e10, mid;
while(r-l>EPS){
mid = (l+r)/2;
vector <pair<ld,ld>> seg;
for(int i=0; i<n; i++){
ld x = pts[i].first, y = pts[i].second;
if(mid <= y){
continue;
}
ld d = sqrt(mid*mid-y*y);
if(x-d <= L && x+d >= 0)
seg.push_back({max((ld)0.0, x-d),min((ld)L, x+d)});
}
sort(seg.begin(), seg.end());
vector <pair<ld,ld>> processed;
for(auto [start,end] : seg){
if(!processed.empty() && start<=processed.back().second){
processed.back().second = max(processed.back().second, end);
}
else{
processed.push_back({start, end});
}
}
bool can = false;
if(processed.size() == 1){
auto [x,y] = processed[0];
if(abs(x) < EPS && abs(y-L) < EPS){
can = true;
}
}
if(can) r = mid;
else l = mid;
}
cout << fixed << setprecision(6) << l << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
464 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
456 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
772 KB |
Output is correct |
2 |
Correct |
18 ms |
796 KB |
Output is correct |
3 |
Correct |
8 ms |
856 KB |
Output is correct |
4 |
Correct |
7 ms |
780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
1124 KB |
Output is correct |
2 |
Correct |
32 ms |
1120 KB |
Output is correct |
3 |
Correct |
41 ms |
1152 KB |
Output is correct |
4 |
Correct |
16 ms |
1120 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
21 ms |
1040 KB |
Output is correct |
2 |
Correct |
31 ms |
1120 KB |
Output is correct |
3 |
Correct |
42 ms |
1096 KB |
Output is correct |
4 |
Correct |
15 ms |
1116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
1040 KB |
Output is correct |
2 |
Correct |
41 ms |
1116 KB |
Output is correct |
3 |
Correct |
46 ms |
1152 KB |
Output is correct |
4 |
Correct |
15 ms |
1140 KB |
Output is correct |
5 |
Correct |
22 ms |
1096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
338 ms |
10076 KB |
Output is correct |
2 |
Correct |
770 ms |
12252 KB |
Output is correct |
3 |
Correct |
491 ms |
6504 KB |
Output is correct |
4 |
Correct |
285 ms |
11092 KB |
Output is correct |
5 |
Correct |
254 ms |
6048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
415 ms |
10268 KB |
Output is correct |
2 |
Correct |
335 ms |
11348 KB |
Output is correct |
3 |
Correct |
379 ms |
11412 KB |
Output is correct |
4 |
Correct |
295 ms |
10848 KB |
Output is correct |
5 |
Correct |
274 ms |
11460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
995 ms |
10084 KB |
Output is correct |
2 |
Correct |
840 ms |
10644 KB |
Output is correct |
3 |
Execution timed out |
1014 ms |
11316 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
840 ms |
11384 KB |
Output is correct |
2 |
Execution timed out |
1065 ms |
11760 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
370 ms |
10976 KB |
Output is correct |
2 |
Execution timed out |
1014 ms |
13228 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1051 ms |
48208 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1032 ms |
48188 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1047 ms |
68500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1071 ms |
68520 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1027 ms |
71608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1103 ms |
71476 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1041 ms |
74724 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1061 ms |
74700 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1042 ms |
80880 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1014 ms |
80948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |