# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
687129 | nikhil_kumart21 | Mobile (BOI12_mobile) | C++17 | 1097 ms | 131072 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(vector<vector<ll>>&v,ll mid,ll L){
vector<vector<ll>>a;
// cout<<mid<<endl;
for(auto it:v){
if(mid<it[1])continue;
ll l=it[0]-sqrtl(mid*mid-it[1]*it[1]),r=it[0]+sqrt(mid*mid-it[1]*it[1]);
if(l<=L&&r>=0)
a.push_back({l,r});
// cout<<l<<" "<<r<<endl;
}
if(a.empty())return 1;
// cout<<endl;
// if()
if(a[0][0]>0)return 1;
ll num=a[0][1];
for(int i=1;i<a.size();++i){
auto it=a[i];
if(it[0]>num)return 1;
num=max(num,it[1]);
}
if(num<L)return 1;
return 0;
}
int main()
{
// setIO("angry");
ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);
ll n,L;
cin>>n>>L;
vector<vector<ll>>v;
for(int i=0;i<n;++i){
ll l,r;
cin>>l>>r;
v.push_back({l,r});
}
ll l=0,r=2e9,mid,ans=0;
while(l<=r){
mid=l+(r-l)/2;
if(fun(v,mid,L)){
l=mid+1e-5;
ans=mid;
}
else{
r=mid-1e-5;
}
}
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... |