제출 #1118876

#제출 시각아이디문제언어결과실행 시간메모리
1118876kfhjadBalloons (CEOI11_bal)C++17
100 / 100
148 ms5972 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
    cin.tie(NULL) -> sync_with_stdio(false);
    int N;
    cin >> N;
    
    stack<pair<ll, long double>> mono;
    mono.push({-1e9, 1});
    
    cout << fixed << setprecision(5);
     
    while (N--)
    {
        ll x;
        long double r;
        cin >> x >> r;
        
        while (!mono.empty())
        {
            auto [x1, r1] = mono.top();
            long double newR = (x - x1) * (x - x1) / (4 * r1);
            r = min(r, newR);
            
            if (r < r1)
                break;
            
            mono.pop();
        }
        
        cout << r << '\n';
        mono.push({x, r});
    }
	
    return 0;
}
#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...