이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define int long long
#define pi pair<int, int>
#define mp make_pair
#define ld long double
#define fi first
#define se second
#define db double
const int MODa = 7 + (int)1e9;
const int INF = (int)4e18;
const int MOD = 998244353;
int n, l;
const int MXN = 1000005;
int x[MXN]{};
int y[MXN]{};
bool check(db r)
{
db mx = 0;
db rr = r*r;
//cerr<<"r = "<<r<<"\n";
for(int i=1; i<=n; i++)
{
if(r<y[i]) continue;
db sqv = sqrtl(rr - y[i]*y[i]);
if(x[i]-sqv>mx) continue;
mx = max(mx, x[i]+sqv);
//cerr<<i<<" "<<mx<<"\n";
if(mx>=l) return true;
}
return false;
}
void solve()
{
cin>>n>>l;
for(int i=1; i<=n; i++)
{
cin>>x[i]>>y[i];
}
db high = 6e9;
db low = 0;
while(high-low>0.001)
{
db mid = (high+low)/2;
if(check(mid)) high = mid;
else low = mid;
}
cout<<setprecision(30);
cout<<low<<"\n";
}
signed main()
{
fast_io;
int t=1;
//cin>>t;
while(t--)
{
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |