Submission #435298

# Submission time Handle Problem Language Result Execution time Memory
435298 2021-06-23T07:18:43 Z harshith828 Balloons (CEOI11_bal) C++14
20 / 100
206 ms 8364 KB
#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(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long int n;
    cin >> n;
    stack<pair<long long int,double>> s;
    long long int x,r;
    vector<long double> v;
    for(int i = 0;i < n;i++){
        cin >> x >> r;
        long double radius = r;
        //cout << x << " " << r << "\n";
        while(!s.empty() and (s.top()).first + (s.top()).second >= x - r ){
           // cout << radius << " ";
            radius = get_min((((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),radius);
            //cout << (((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)) << " " << r << " " << s.top().second << "\n";
            radius = get_min(radius,r);
            if(radius > s.top().second){
                s.pop();
            }
            else{
                break;
            }
        }
       // cout <<"\n"; 
        v.push_back(radius);
        s.push(make_pair(x,radius));
    }
    for(int i = 0;i < n;i++){
        if(i != n - 1){
            cout << fixed << setprecision(6) << v[i] << "\n";
        }
        else{
            cout << fixed << setprecision(6) << v[i];
        }
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 332 KB 399th numbers differ - expected: '9.9760000000', found: '37.0000000000', error = '27.0240000000'
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 1128 KB 1209th numbers differ - expected: '72.2820000000', found: '178.0000000000', error = '105.7180000000'
# Verdict Execution time Memory Grader output
1 Incorrect 53 ms 2280 KB 13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 4444 KB 7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000'
# Verdict Execution time Memory Grader output
1 Incorrect 141 ms 5128 KB 4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 163 ms 6880 KB 1736th numbers differ - expected: '0.0050000000', found: '3.0000000000', error = '2.9950000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 206 ms 8364 KB 2718th numbers differ - expected: '2.2100000000', found: '3.0000000000', error = '0.7900000000'
2 Halted 0 ms 0 KB -