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;
double cal(double x1,double x2,double r1)
{
return (x2-x1)*(x2-x1)/(4*r1);
}
int main()
{
int n;
cin >> n;
stack<pair<double,double>> stk; //{x,r}
vector<double> result;
while(n--)
{
double x,r;
cin >> x >> r;
double maxr=r;
while(!stk.empty())
{
maxr=min(maxr,cal(stk.top().first,x,stk.top().second));
if(maxr>=stk.top().second)
stk.pop();
else
break;
}
stk.push({x,maxr});
result.push_back(maxr);
}
cout << fixed << setprecision(3);
for(auto r:result)
cout << r << endl;
}
# | 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... |