#include <iostream>
#include <math.h>
#include <stack>
using namespace std;
struct bb {
    double x, r;
    bb () {}
    bb (double X, double R) {
        x = X;
        r = R;
    }
};
int n;
bb k;
stack <bb> st, tmp;
double dis(bb A, bb B) {
    return sqrt((A.x - B.x) * (A.x - B.x) + (A.r - B.r) * (A.r - B.r));
}
double Find(bb kt) {
    return (kt.x - k.x) * (kt.x - k.x) / (4.0 * kt.r);
}
int main() {
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> k.x >> k.r;
        double ans;
        if (st.empty()) {
            printf("%.3f\n", k.r);
            ans = k.r;
        } else {
            ans = k.r;
            int cnt = 0;
            while (!st.empty()) {
                ++cnt;
                if (cnt > 100) break;
                ans = min(ans, Find(st.top()));
                tmp.push(st.top());
                st.pop();
            }
            while (!tmp.empty()) {
                st.push(tmp.top());
                tmp.pop();
            }
            while (!st.empty() && st.top().r < ans) st.pop();
            printf("%.3f\n", ans);
        }
        st.push(bb(k.x, ans));
    }
    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... |