제출 #435264

#제출 시각아이디문제언어결과실행 시간메모리
435264harshith828Balloons (CEOI11_bal)C++14
10 / 100
296 ms5116 KiB
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;

long double get_min(long double x1,long double x2){
    if(x1 > x2){
        return x2;
    }
    return x1;
}

int main(){
    
    long long int n;
    cin >> n;
    stack<pair<long long int,long double>> s;
    long long int x,r;
    vector<long double> v;
    for(int i = 0;i < n;i++){
        cin >> x >> r;
        long double radius;
        while(!s.empty()  and get_min((((long double)(pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),r) >= s.top().second){
            s.pop();
        }
        if(!s.empty()){
            radius = (((long double)(pow((s.top()).first - x,2)))/(4.000*(s.top()).second));
        }
        else{
            radius = r;
        }
        if(radius > r){
            radius = r;
        }
        v.push_back(radius);
        s.push(make_pair(x,radius));
    }
    for(int i = 0;i < n;i++){
        cout << fixed << setprecision(3);
        if(i != n - 1){
            cout << v[i] << "\n";
        }
        else{
            cout << v[i];
        }
    }
    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...