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 <vector>
#include <string>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <deque>
#include <numeric>
#include <cmath>
#include <cstring>
#include <climits>
#include <stack>
#include <bitset>
typedef long long ll;
using namespace std;
// https://oj.uz/problem/view/CEOI11_bal
int main() {
    ll n; cin >> n;
    long double inflated[n]; // final inflated radii
    stack<pair<ll,ll>> s;
    for (int i = 0; i<n; i++) {
        ll x,r; cin >> x >> r;
        double constraint = r;
        while (!s.empty()) {
            double c = (x-s.top().first)*(x-s.top().first)/(double)(4*s.top().second);
            constraint = min(constraint,c);
            if (constraint > s.top().second) s.pop(); // we are sure that we can inflate to at least s.top().second
            else break; // now we are sure that a stronger constraint cannot be delivered
        }
        inflated[i] = constraint; s.push({x,constraint});
        cout << inflated[i] << '\n';
    }
}
| # | 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... |