#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
typedef long long ll;
const int N = 1e6+5, mod = 1e9+7;
int n, m;
pair<double, double> p[N];
stack<pair<int, pair<double, double>>> s;
double dis(int i, double x)
{
double y = 0;
return hypot((x-p[i].f), (y-p[i].s));
}
int main()
{
cin >> n >> m;
for(int i=0; i<n; i++) cin >> p[i].f >> p[i].s;
for(int i=0; i<n; i++)
{
if(s.empty()) s.push({i, {0, m}});
else
{
auto t = s.top();
if(dis(t.f, t.s.f) >= dis(i, t.s.f))
{
s.pop();
s.push({i, {t.s.f, t.s.s}});
}
else if(dis(t.f, t.s.s) > dis(i, t.s.s))
{
double x, x1 = p[i].f, x2 = p[t.f].f;
double y1 = p[i].s, y2 = p[t.f].s;
x = (x1*x1 - x2*x2 + y1*y1-y2*y2)/(2*x1-2*x2);
s.pop();
t.s.s = x;
s.push(t), s.push({i, {x, m}});
}
}
}
double ans = 0;
while(!s.empty())
{
auto t = s.top();
s.pop();
ans = max(ans, max(dis(t.f, t.s.f), dis(t.f, t.s.s)));
}
cout << fixed << setprecision(4) << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
380 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
107 ms |
2312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
111 ms |
2424 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
4496 KB |
Output is correct |
2 |
Incorrect |
135 ms |
2696 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
174 ms |
3448 KB |
Output is correct |
2 |
Incorrect |
162 ms |
3248 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
172 ms |
3484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
661 ms |
24708 KB |
Output is correct |
2 |
Correct |
854 ms |
16088 KB |
Output is correct |
3 |
Correct |
833 ms |
15588 KB |
Output is correct |
4 |
Incorrect |
987 ms |
17912 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
894 ms |
16344 KB |
Output is correct |
2 |
Incorrect |
833 ms |
14852 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
762 ms |
29468 KB |
Output is correct |
2 |
Execution timed out |
1022 ms |
19248 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1060 ms |
19624 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
892 ms |
34500 KB |
Output is correct |
2 |
Execution timed out |
1047 ms |
19840 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1077 ms |
20472 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1063 ms |
39280 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1065 ms |
19484 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1061 ms |
23004 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1047 ms |
19980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |