#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, i;
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();
}
i = 1;
while (i <= n) {
Point best_point = points[i];
int pos_best_point = i;
i++;
while (i <= n && points[i].x == points[i - 1].x) {
if (abs(points[i].y) < abs(best_point.y)) {
best_point = points[i];
pos_best_point = i;
}
i++;
}
if (ind_st >= 1 && WhereBetter(best_point, points[st[ind_st].first]) > l) {
continue;
}
while (ind_st >= 1 && WhereBetter(best_point, points[st[ind_st].first]) < st[ind_st].second) {
ind_st--;
}
if (ind_st == 0) {
st[++ind_st] = { pos_best_point, 1 };
}
else {
long double x = WhereBetter(best_point, points[st[ind_st].first]);
st[++ind_st] = { pos_best_point, x };
}
}
//for (int i = 1; i <= n; i++) {
// if (ind_st >= 1 && points[i].x == points[st[ind_st].first].x) {
// continue;
// }
// if (ind_st >= 1 && 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--;
// }
// if (ind_st == 0) {
// st[++ind_st] = { i, 1 };
// }
// else {
// long double x = WhereBetter(points[i], points[st[ind_st].first]);
// st[++ind_st] = { i, x };
// }
//}
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 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
628 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
856 KB |
Output is correct |
2 |
Incorrect |
1 ms |
604 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
604 KB |
Output is correct |
2 |
Incorrect |
4 ms |
604 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
2704 KB |
Output is correct |
2 |
Incorrect |
22 ms |
2648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
2908 KB |
Output is correct |
2 |
Correct |
20 ms |
2652 KB |
Output is correct |
3 |
Correct |
23 ms |
2968 KB |
Output is correct |
4 |
Correct |
24 ms |
2880 KB |
Output is correct |
5 |
Correct |
31 ms |
3080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
32 ms |
5896 KB |
Output is correct |
2 |
Incorrect |
29 ms |
3304 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
31 ms |
3416 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
4184 KB |
Output is correct |
2 |
Incorrect |
27 ms |
3416 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
140 ms |
31652 KB |
Output is correct |
2 |
Incorrect |
146 ms |
15940 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
141 ms |
16100 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
158 ms |
37900 KB |
Output is correct |
2 |
Incorrect |
163 ms |
19208 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
168 ms |
19032 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
189 ms |
44112 KB |
Output is correct |
2 |
Incorrect |
196 ms |
22352 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
199 ms |
22240 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
217 ms |
50400 KB |
Output is correct |
2 |
Incorrect |
232 ms |
25424 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
225 ms |
25296 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
283 ms |
63088 KB |
Output is correct |
2 |
Incorrect |
280 ms |
31688 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
277 ms |
31732 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |