/*
_____ _ _
/ ____| | | | |
| | __ _ __ __ _ ___ ___ _ _ _ __ ___ | |_ __ _| |_ ___
| | |_ | '__/ _` / __/ __| | | | '_ \ / _ \| __/ _` | __/ _ \
| |__| | | | (_| \__ \__ \ |_| | |_) | (_) | || (_| | || (_) |
\_____|_| \__,_|___/___/\__, | .__/ \___/ \__\__,_|\__\___/
__/ | |
|___/|_|
*/
#include <fstream>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <array>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <cstring>
#include <bitset>
#include <string>
#include <sstream>
using namespace std;
using ll = long long;
const int INF = 1e6 + 5;
const int MOD = 1e9 + 7;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
int N, L;
pair<ll, ll> xy[INF];
bool check (double radius) {
vector<pair<double, double>> seg;
for (int i = 0; i < N; i++) {
double horz = sqrt(radius * radius - xy[i].second * xy[i].second);
double left = xy[i].first - horz, right = xy[i].first + horz;
seg.push_back(make_pair(left, right));
}
double search = 0;
for (int i = 0; i < N; i++) {
if (seg[i].first <= search && search <= seg[i].second) {
search = seg[i].second;
}
}
return search >= L;
}
int main()
{
std::ios_base::sync_with_stdio(false); cin.tie(0);
// ifstream cin(".in");
// ofstream cout(".out");
cin >> N >> L;
for (int i = 0; i < N; i++) cin >> xy[i].first >> xy[i].second;
double l = 0, r = 1.5 * 1e9;
for (int i = 0; i < 100; i++) {
double m = (l + r) / 2;
if (check(m)) {
r = m;
} else {
l = m;
}
}
cout << fixed << setprecision(6) << l << '\n';
return 0;
}
/*
*
*/
//
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
324 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
460 KB |
Output is correct |
2 |
Correct |
5 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
332 KB |
Output is correct |
4 |
Correct |
4 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
604 KB |
Output is correct |
2 |
Correct |
12 ms |
668 KB |
Output is correct |
3 |
Correct |
11 ms |
652 KB |
Output is correct |
4 |
Correct |
12 ms |
684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
604 KB |
Output is correct |
2 |
Correct |
12 ms |
668 KB |
Output is correct |
3 |
Correct |
12 ms |
652 KB |
Output is correct |
4 |
Correct |
12 ms |
684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
620 KB |
Output is correct |
2 |
Correct |
11 ms |
664 KB |
Output is correct |
3 |
Correct |
12 ms |
604 KB |
Output is correct |
4 |
Correct |
12 ms |
604 KB |
Output is correct |
5 |
Correct |
11 ms |
652 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
254 ms |
4924 KB |
Output is correct |
2 |
Correct |
230 ms |
6112 KB |
Output is correct |
3 |
Correct |
140 ms |
3752 KB |
Output is correct |
4 |
Correct |
228 ms |
6020 KB |
Output is correct |
5 |
Correct |
130 ms |
3384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
224 ms |
5152 KB |
Output is correct |
2 |
Correct |
221 ms |
5508 KB |
Output is correct |
3 |
Correct |
242 ms |
6032 KB |
Output is correct |
4 |
Correct |
238 ms |
6180 KB |
Output is correct |
5 |
Correct |
263 ms |
6588 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
250 ms |
5224 KB |
Output is correct |
2 |
Correct |
241 ms |
5232 KB |
Output is correct |
3 |
Correct |
246 ms |
5232 KB |
Output is correct |
4 |
Correct |
284 ms |
5756 KB |
Output is correct |
5 |
Correct |
274 ms |
6232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
270 ms |
5612 KB |
Output is correct |
2 |
Correct |
287 ms |
5704 KB |
Output is correct |
3 |
Correct |
265 ms |
5572 KB |
Output is correct |
4 |
Correct |
290 ms |
5628 KB |
Output is correct |
5 |
Correct |
283 ms |
6908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
290 ms |
5536 KB |
Output is correct |
2 |
Correct |
285 ms |
5656 KB |
Output is correct |
3 |
Correct |
271 ms |
5624 KB |
Output is correct |
4 |
Correct |
281 ms |
5684 KB |
Output is correct |
5 |
Correct |
274 ms |
6852 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1096 ms |
24264 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1082 ms |
24392 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
35724 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1053 ms |
35616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1084 ms |
39068 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1098 ms |
38684 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1091 ms |
41844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
41920 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1093 ms |
48128 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
48080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |