# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1125145 | I_FloPPed21 | Mobile (BOI12_mobile) | C++20 | 0 ms | 0 KiB |
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
const int N=1e6+5;
struct orientare
{
long long x,y;
}v[N];
int n,k;
void solve()
{
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>v[i].x>>v[i].y;
}
long double st=0,dr=1e10;
while(dr-st>0.00001)
{
double mij=(st+dr)/2;
double curr=0;
for(int i=1;i<=n;i++)
{
double add=sqrt(mij*mij-v[i].y*v[i].y);
double left=v[i].x-add;
double right=v[i].x+add;
if(left<=curr)
curr=max(curr,right);
}
if(curr>=k)
dr=mij;
else
st=mij;
}
cout<<fixed<<setprecision(6)<<dr<<'\n';
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
solve();
return 0;
}
`