#include "bits/stdc++.h"
#define INF 1e18
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<pair<double, double>> balloons(n);
for (int i = 0; i < n; i++) {
cin >> balloons[i].first >> balloons[i].second;
}
stack<pair<double, double>> s;
vector<double> ans(n);
for (int i = 0; i < n; i++) {
pair<double, double> b = balloons[i];
if (s.empty()) {
ans[i] = b.second;
s.push(b);
} else {
while (!s.empty()) {
double new_r = pow(s.top().first - b.first, 2) / (4 * s.top().second);
new_r = min(new_r, b.second);
if (new_r > s.top().second) {
s.pop();
} else {
s.push(b);
ans[i] = new_r;
break;
}
}
}
}
for (int i = 0; i < n; i++) {
cout << fixed << setprecision(3) << ans[i] << 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... |