# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
687192 | nikhil_kumart21 | Mobile (BOI12_mobile) | C++17 | 1094 ms | 50928 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long double ll;
#define endl "\n";
void setIO(string s) {
freopen((s + ".in").c_str(), "r", stdin);
freopen((s + ".out").c_str(), "w", stdout);
}
ll fun(ll x[],ll y[],int n,ll mid,ll L){
// cout<<mid<<endl;
ll num=0;
for(int i=0;i<n;++i){
if(mid<y[i])continue;
ll l=x[i]-sqrtl(mid*mid-y[i]*y[i]),r=x[i]+sqrtl(mid*mid-y[i]*y[i]);
if(l<=num){
num=max(num,r);
}
// cout<<l<<" "<<r<<endl;
}
return num<L;
}
int main()
{
// setIO("angry");
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
int n;
ll L;
cin>>n>>L;
ll x[n],y[n];
for(int i=0;i<n;++i){
ll l,r;
cin>>x[i]>>y[i];
}
// sort(v.begin(),v.end(),comp);
ll l=0,r=2e9,mid,ans=0;
while(l<=r){
mid=l+(r-l)/2;
if(fun(x,y,n,mid,L)){
l=mid+1e-4;
ans=mid;
}
else{
r=mid-1e-4;
}
}
cout<<fixed<<setprecision(3)<<ans<<endl;
}
Compilation message (stderr)
# | 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... |