Submission #435264

# Submission time Handle Problem Language Result Execution time Memory
435264 2021-06-23T06:28:46 Z harshith828 Balloons (CEOI11_bal) C++14
10 / 100
296 ms 5116 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(){
    
    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 time Memory Grader output
1 Correct 1 ms 204 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB 6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 332 KB 79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000'
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 936 KB 137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000'
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 1592 KB 250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 2824 KB 162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000'
# Verdict Execution time Memory Grader output
1 Incorrect 176 ms 3184 KB 510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 240 ms 4460 KB 161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 296 ms 5116 KB 248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000'
2 Halted 0 ms 0 KB -