#include <bits/stdc++.h>
using namespace std;
struct Ball
{
double x, r;
};
int n;
vector<Ball> balls;
double expected_r(Ball a, double x)
{
return (x - a.x) * (x - a.x) / (4 * a.r);
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(3);
cin >> n;
for (int i = 0; i < n; i++)
{
double x, r;
cin >> x >> r;
while (!balls.empty())
{
r = min(r, expected_r(balls.back(), x));
if (r >= balls.back().r) balls.pop_back();
else break;
}
cout << r << "\n";
balls.push_back(Ball{x, r});
}
}
| # | 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... |