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 <stack>
#include <iomanip>
using namespace std;
int n;
stack < pair <int,double> > s;
double raza_maxima(int x,double r)
{
while(!s.empty())
{
int x1=s.top().first;
double r1=s.top().second;
double rnou=(double)(x-x1)*(x-x1)/(double)(4*r1);
//cout << rnou << '\n';
//cout << s.size() << 'w';
if(r<rnou)
{
break;
}
r=rnou;
s.pop();
}
s.push({x,r});
return r;
}
int main()
{
cin >> n;
for(int i=1;i<=n;i++)
{
int x;
double r;
cin >> x >> r;
cout << fixed << setprecision(3) << raza_maxima(x,r) << '\n';
}
// while(!s.empty())
// {
// cout << s.top().first << ' ' << s.top().second << '\n';
// s.pop();
// }
}
# | 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... |