#include <iostream>
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <set>
#define ll long long
using namespace std;
const int NMAX = 1e6;
const long double EPS = 1e-3;
struct Point {
long double x, y;
void read() {
cin >> x >> y;
}
}points[NMAX + 1];
int n, l, ind_st;
long double answer;
pair<int, long double> st[NMAX + 1];
long double Square(long double x) {
return x * x;
}
long double Distance(Point p1, Point p2) {
return sqrt(Square(p1.x - p2.x) + Square(p1.y - p2.y));
}
long double WhereBetter(Point p1, Point p2) {
return (long double)(Square(p2.x) + Square(p2.y) - Square(p1.x) - Square(p1.y)) / (long double)(2 * (p2.x - p1.x));
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n >> l;
for (int i = 1; i <= n; i++) {
points[i].read();
}
st[++ind_st] = { 1, 0 };
for (int i = 2; i <= n; i++) {
if (WhereBetter(points[i], points[st[ind_st].first]) > l) {
continue;
}
while (ind_st >= 1 && WhereBetter(points[i], points[st[ind_st].first]) < st[ind_st].second) {
ind_st--;
}
ind_st++;
st[ind_st] = {i, WhereBetter(points[i], points[st[ind_st - 1].first])};
}
for (int i = 1; i <= ind_st; i++) {
answer = max(answer, max(Distance(points[st[i].first], { st[i].second, 0 }), Distance(points[st[i].first], { (i == ind_st ? l : st[i + 1].second - EPS), 0 })));
}
cout << fixed << setprecision(6) << answer << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Correct |
2 ms |
604 KB |
Output is correct |
3 |
Incorrect |
3 ms |
604 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
19 ms |
3676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
20 ms |
3460 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
6480 KB |
Output is correct |
2 |
Incorrect |
23 ms |
4068 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
30 ms |
4948 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
5716 KB |
Output is correct |
2 |
Incorrect |
27 ms |
4952 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
132 ms |
35920 KB |
Output is correct |
2 |
Incorrect |
139 ms |
23804 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
141 ms |
24144 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
203 ms |
43144 KB |
Output is correct |
2 |
Incorrect |
174 ms |
28500 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
180 ms |
29008 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
200 ms |
50252 KB |
Output is correct |
2 |
Incorrect |
201 ms |
32996 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
204 ms |
33872 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
208 ms |
57680 KB |
Output is correct |
2 |
Incorrect |
226 ms |
37712 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
278 ms |
38484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
263 ms |
71688 KB |
Output is correct |
2 |
Incorrect |
311 ms |
47188 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
305 ms |
48208 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |