#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef long double ld;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll n, l;
cin >> n >> l;
vector<pll> arr(n);
for (auto &ref: arr) cin >> ref.first >> ref.second;
ld start = 0;
ld end = 1.42e9;
while (end - start > 1e-4) {
ld mid = start + (end - start) / 2;
bool check = false;
{
vector<pair<ld, ld>> ranges(n);
for (int i = 0; i < n; i++) {
if (mid < arr[i].second) continue;
ld center = arr[i].first;
ld delta = sqrt(mid * mid - (ld) (arr[i].second * arr[i].second));
ranges[i] = {center - delta, center + delta};
}
if (ranges.empty()) {
check = false;
} else {
std::sort(ranges.begin(), ranges.end());
vector<pair<ld, ld>> intersects;
for (int i = 0; i < n; i++) {
if (intersects.empty())
intersects.push_back(ranges[i]);
else {
if (ranges[i].first <= intersects.back().second) {
intersects.back().second = max(intersects.back().second, ranges[i].second);
} else
intersects.push_back(ranges[i]);
}
}
for (auto& seg : intersects) {
if (seg.first <= 0 && l <= seg.second) {
check = true;
break;
}
}
}
}
if (check)
end = mid;
else
start = mid;
}
cout << fixed << setprecision(6) << start << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
840 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
26 ms |
700 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
700 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
700 KB |
Output is correct |
2 |
Correct |
13 ms |
700 KB |
Output is correct |
3 |
Correct |
20 ms |
700 KB |
Output is correct |
4 |
Incorrect |
30 ms |
952 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
3960 KB |
Output is correct |
2 |
Correct |
350 ms |
5120 KB |
Output is correct |
3 |
Correct |
290 ms |
3536 KB |
Output is correct |
4 |
Incorrect |
570 ms |
8400 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
470 ms |
5904 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
265 ms |
4576 KB |
Output is correct |
2 |
Correct |
406 ms |
4316 KB |
Output is correct |
3 |
Correct |
510 ms |
5384 KB |
Output is correct |
4 |
Incorrect |
832 ms |
10480 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
382 ms |
5392 KB |
Output is correct |
2 |
Correct |
524 ms |
6556 KB |
Output is correct |
3 |
Correct |
588 ms |
6264 KB |
Output is correct |
4 |
Incorrect |
803 ms |
10240 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
322 ms |
5908 KB |
Output is correct |
2 |
Correct |
548 ms |
6552 KB |
Output is correct |
3 |
Correct |
611 ms |
6180 KB |
Output is correct |
4 |
Incorrect |
847 ms |
10324 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1073 ms |
23936 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1074 ms |
23888 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
28632 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1070 ms |
28500 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1044 ms |
33320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1041 ms |
33320 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1057 ms |
38028 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1064 ms |
38020 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1078 ms |
47332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1075 ms |
47336 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |