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 <iomanip>
#include <stack>
#define x first
#define r second
using namespace std;
int N;
double X, R;
stack < pair <double, double> > S;
double balloon(double X, double R)
{
while (!S.empty())
{
pair <double, double> p = S.top();
R = min(R, (p.x - X) * (p.x - X) / (4.0 * p.r));
if (R > p.r)
S.pop();
else
break;
}
S.push({X, R});
return R;
}
int main()
{
cin >> N;
for (int i = 1; i <= N; ++i)
{
cin >> X >> R;
cout << fixed << setprecision(3) << balloon(X, R) << '\n';
}
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... |