Submission #840897

# Submission time Handle Problem Language Result Execution time Memory
840897 2023-08-31T20:25:43 Z PagodePaiva Balloons (CEOI11_bal) C++17
10 / 100
228 ms 4892 KB
#include<bits/stdc++.h>
#define N 200010
#define int long long
#define double long double

using namespace std;

double res[N];

int32_t main(){
    int n;
    cin >> n;
    stack <pair <double, double>> s;
    s.push({0, 0});

    cout << fixed << setprecision(3);

    for(int i = 1;i <= n;i++){
        double a, b;
        cin >> a >> b;

        while(!s.empty()){
            auto [x, y] = s.top();
            // cout << x << ' ' << y << '\n';
            if(y == 0){
                res[i] = b;
                break;
            }

            res[i] = min(b, ((a-x)*(a-x))/(4*y));

            // cout << res[i] << ' ';

            if(res[i] >= y){
                s.pop();
            }

            else{
                // cout << y << "\n";
                break;
            }
        }

        s.push({a, res[i]});
    }

    for(int i = 1;i <= n;i++){
        cout << res[i] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB 2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 340 KB 79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 724 KB 137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 57 ms 1420 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 120 ms 2620 KB 162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 3024 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 178 ms 4088 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 228 ms 4892 KB 248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000'
2 Halted 0 ms 0 KB -