/*
_____ _ _
/ ____| | | | |
| | __ _ __ __ _ ___ ___ _ _ _ __ ___ | |_ __ _| |_ ___
| | |_ | '__/ _` / __/ __| | | | '_ \ / _ \| __/ _` | __/ _ \
| |__| | | | (_| \__ \__ \ |_| | |_) | (_) | || (_| | || (_) |
\_____|_| \__,_|___/___/\__, | .__/ \___/ \__\__,_|\__\___/
__/ | |
|___/|_|
*/
#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 current = 0;
for (int i = 0; i < N; i++) {
if (seg[i].first <= current) current = max(current, seg[i].second);
}
return current >= 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 = 1, r = 1.5 * 1e9;
while (r - l > 1e-3) {
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 |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 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 |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Output is correct |
2 |
Correct |
2 ms |
460 KB |
Output is correct |
3 |
Correct |
3 ms |
332 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
604 KB |
Output is correct |
2 |
Correct |
6 ms |
604 KB |
Output is correct |
3 |
Correct |
5 ms |
604 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
620 KB |
Output is correct |
2 |
Correct |
6 ms |
620 KB |
Output is correct |
3 |
Correct |
5 ms |
604 KB |
Output is correct |
4 |
Correct |
8 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
612 KB |
Output is correct |
2 |
Correct |
6 ms |
604 KB |
Output is correct |
3 |
Correct |
7 ms |
620 KB |
Output is correct |
4 |
Correct |
6 ms |
748 KB |
Output is correct |
5 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
4932 KB |
Output is correct |
2 |
Correct |
108 ms |
4840 KB |
Output is correct |
3 |
Correct |
63 ms |
3100 KB |
Output is correct |
4 |
Correct |
107 ms |
4924 KB |
Output is correct |
5 |
Correct |
58 ms |
2964 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
106 ms |
4920 KB |
Output is correct |
2 |
Correct |
98 ms |
4764 KB |
Output is correct |
3 |
Correct |
115 ms |
5156 KB |
Output is correct |
4 |
Correct |
106 ms |
4924 KB |
Output is correct |
5 |
Correct |
111 ms |
5180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
104 ms |
5196 KB |
Output is correct |
2 |
Correct |
118 ms |
5196 KB |
Output is correct |
3 |
Correct |
106 ms |
5140 KB |
Output is correct |
4 |
Correct |
132 ms |
5556 KB |
Output is correct |
5 |
Correct |
113 ms |
5228 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
143 ms |
5700 KB |
Output is correct |
2 |
Correct |
126 ms |
5568 KB |
Output is correct |
3 |
Correct |
122 ms |
5572 KB |
Output is correct |
4 |
Correct |
137 ms |
5568 KB |
Output is correct |
5 |
Correct |
135 ms |
5580 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
132 ms |
5552 KB |
Output is correct |
2 |
Correct |
126 ms |
5576 KB |
Output is correct |
3 |
Correct |
121 ms |
5588 KB |
Output is correct |
4 |
Correct |
129 ms |
5736 KB |
Output is correct |
5 |
Correct |
125 ms |
5560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
651 ms |
24220 KB |
Output is correct |
2 |
Correct |
679 ms |
24232 KB |
Output is correct |
3 |
Correct |
657 ms |
24260 KB |
Output is correct |
4 |
Correct |
693 ms |
24300 KB |
Output is correct |
5 |
Correct |
679 ms |
24312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
669 ms |
24240 KB |
Output is correct |
2 |
Correct |
723 ms |
24352 KB |
Output is correct |
3 |
Correct |
648 ms |
24272 KB |
Output is correct |
4 |
Correct |
705 ms |
24452 KB |
Output is correct |
5 |
Correct |
669 ms |
24284 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
904 ms |
35704 KB |
Output is correct |
2 |
Correct |
971 ms |
45188 KB |
Output is correct |
3 |
Correct |
951 ms |
44296 KB |
Output is correct |
4 |
Correct |
985 ms |
47580 KB |
Output is correct |
5 |
Correct |
943 ms |
43808 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
937 ms |
35612 KB |
Output is correct |
2 |
Correct |
986 ms |
43572 KB |
Output is correct |
3 |
Correct |
877 ms |
42544 KB |
Output is correct |
4 |
Correct |
929 ms |
47504 KB |
Output is correct |
5 |
Correct |
891 ms |
44416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
952 ms |
38952 KB |
Output is correct |
2 |
Correct |
983 ms |
48428 KB |
Output is correct |
3 |
Correct |
973 ms |
49052 KB |
Output is correct |
4 |
Execution timed out |
1029 ms |
52444 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
983 ms |
38748 KB |
Output is correct |
2 |
Execution timed out |
1049 ms |
47936 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1045 ms |
41892 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
41904 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1090 ms |
48108 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1088 ms |
48080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |