#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define inf 1000000007ll
#define llmax LLONG_MAX
#define pi 3.141592653589793238462643383279502884197169399
long long binpow(long long a, long long b) {
long long res = 1;
while (b > 0) {
if (b & 1)
res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
ll ncr(int n, int r)
{
if (n < r) return 0;
long long p = 1, k = 1;
if (n - r < r)
r = n - r;
if (r != 0) {
while (r) {
p *= n;
k *= r;
long long m = __gcd(p, k);
p /= m;
k /= m;
n--;
r--;
}
}
else
p = 1;
return p;
}
vector <ll> vcreate(int n){
vector <ll> v(n);
for (int i = 0; i < n; i++)
{
cin>>v[i];
}
return v;
}
int dx[4]{1, -1, 0, 0}, dy[4]{0, 0, 1, -1};
const int MOD=998244353;
ll ModExp(ll x, ll n, ll m) {
assert(n >= 0);
x %= m; // note: m * m must be less than 2^63 to avoid ll overflow
ll res = 1;
while (n > 0) {
if (n % 2 == 1) { res = res * x % m; }
x = x * x % m;
n /= 2;
}
return res;
}
long double dist(pair<long double,long double> x, pair<long double, long double> y)
{
return sqrtl((x.first-y.first)*(x.first-y.first) +(x.second-y.second)*(x.second-y.second));
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
/* freopen("prime_subtractorization_input.txt", "r", stdin);
freopen("output.txt", "w", stdout); */
/* ll T;
cin>>T;
for(ll oo=0; oo<T; oo++)
{
} */
long double n{},l{};
cin>>n>>l;
vector<pair<long double,long double>> v(n);
for(int i{0}; i<n; i++)
{
cin>>v[i].first>>v[i].second;
v[i].second=abs(v[i].second);
}
vector<pair<long double,long double>> range(n,{0,l});
stack<int> st;
for(int i{0}; i<n; i++)
{
while(!st.empty())
{
pair<long double,long double> p;
p=v[st.top()];
long double cross=((p.first*p.first-v[i].first*v[i].first)+(p.second*p.second-v[i].second*v[i].second))/(2*p.first-2*v[i].first);
if(cross<=range[st.top()].first)
{
st.pop();
}
else
{
range[st.top()].second=cross;
range[i].first=cross;
break;
}
}
st.push(i);
}
/* for(int i{0}; i<n; i++)
{
cout<<range[i].first<<" "<<range[i].second<<endl;
} */
long double ans=0;
while(!st.empty())
{
long double d= dist(v[st.top()],{range[st.top()].first,0});
long double e=dist(v[st.top()],{range[st.top()].second,0});
ans=max(ans,d);
ans=max(ans,e);
st.pop();
}
cout<<fixed<<setprecision(6);
cout<<ans<<endl;
// cout<<dist({0,0},{4,3})<<endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
604 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
604 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
5124 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
5204 KB |
Expected double, but "inf" found |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
6224 KB |
Output is correct |
2 |
Incorrect |
25 ms |
5468 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
35 ms |
6484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
34 ms |
6740 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
33828 KB |
Output is correct |
2 |
Incorrect |
160 ms |
39284 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
31572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
161 ms |
40272 KB |
Output is correct |
2 |
Incorrect |
193 ms |
47188 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
204 ms |
37972 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
209 ms |
46952 KB |
Output is correct |
2 |
Incorrect |
224 ms |
55124 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
233 ms |
44112 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
259 ms |
53764 KB |
Output is correct |
2 |
Incorrect |
263 ms |
62800 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
263 ms |
50516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
298 ms |
67156 KB |
Output is correct |
2 |
Incorrect |
323 ms |
78600 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
311 ms |
62996 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |