제출 #1186797

#제출 시각아이디문제언어결과실행 시간메모리
1186797njoopBalloons (CEOI11_bal)C++20
100 / 100
121 ms1964 KiB
#include <bits/stdc++.h>

using namespace std;

stack<pair<double, double>> s;
int n;
double x, r;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    for(int i=1; i<=n; i++) {
        cin >> x >> r;
        double cr = r;
        bool cnt=1;
        while(s.size() && cnt) {
            double nx = s.top().first;
            double nr = s.top().second;
            cr = min(cr, (x-nx)*(x-nx)/(4*nr));
            if(nr > cr) {
                cnt = 0;
            } else {
                s.pop();
            }
        }
        s.push({x, cr});
        cout << fixed << setprecision(3) << cr << "\n";
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...