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<iostream>
#include<queue>
#include<iomanip>
using namespace std;
long double getrad(long double x, long double xx, long double rr)
{
long double r=((x-xx)*(x-xx))/(4*rr);
return r;
}
deque<pair<long double,long double> > Q;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
long double x,rmax;
cin>>x>>rmax;
long double r=rmax;
while(!Q.empty())
{
long double xx=Q.back().first;
long double rr=Q.back().second;
r=min(r,getrad(x,xx,rr));
if(r>rr)
Q.pop_back();
else
break;
}
cout<<setprecision(3)<<fixed<<r<<"\n";
Q.push_back({x,r});
}
return 0;
}
# | 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... |