/*
_____ _ _
/ ____| | | | |
| | __ _ __ __ _ ___ ___ _ _ _ __ ___ | |_ __ _| |_ ___
| | |_ | '__/ _` / __/ __| | | | '_ \ / _ \| __/ _` | __/ _ \
| |__| | | | (_| \__ \__ \ |_| | |_) | (_) | || (_| | || (_) |
\_____|_| \__,_|___/___/\__, | .__/ \___/ \__\__,_|\__\___/
__/ | |
|___/|_|
*/
#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<double, double> xy[INF];
bool check (double radius) {
vector<pair<double, double>> segments;
for (int i = 0; i < N; i++) {
double left = xy[i].first - sqrt(pow(radius, 2) - pow(xy[i].second, 2));
double right = xy[i].first + sqrt(pow(radius, 2) - pow(xy[i].second, 2));
segments.push_back(make_pair(left, right));
}
sort(segments.begin(), segments.end());
double search = 0;
for (int i = 0; i < N; i++) {
if (segments[i].first <= search + 1e-4 && search <= segments[i].second - 1e-4) {
search = segments[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 = 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;
}
/*
*
*/
//2 10
//0 0
//11 1
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 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 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
13 ms |
476 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
616 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
33 ms |
624 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
624 KB |
Output is correct |
2 |
Correct |
28 ms |
684 KB |
Output is correct |
3 |
Correct |
35 ms |
656 KB |
Output is correct |
4 |
Incorrect |
41 ms |
696 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
790 ms |
4852 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
601 ms |
4868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
493 ms |
5268 KB |
Output is correct |
2 |
Correct |
734 ms |
5032 KB |
Output is correct |
3 |
Correct |
732 ms |
6088 KB |
Output is correct |
4 |
Incorrect |
821 ms |
7576 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
706 ms |
5592 KB |
Output is correct |
2 |
Correct |
925 ms |
6976 KB |
Output is correct |
3 |
Correct |
834 ms |
6580 KB |
Output is correct |
4 |
Incorrect |
879 ms |
7608 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
594 ms |
5644 KB |
Output is correct |
2 |
Correct |
935 ms |
6968 KB |
Output is correct |
3 |
Correct |
875 ms |
6548 KB |
Output is correct |
4 |
Incorrect |
793 ms |
7472 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1089 ms |
24268 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1099 ms |
24164 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
35588 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
35596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
38780 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
38792 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1097 ms |
41944 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1094 ms |
41824 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
48088 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1064 ms |
48012 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |