Submission #921182

# Submission time Handle Problem Language Result Execution time Memory
921182 2024-02-03T12:12:00 Z 0x34c Balloons (CEOI11_bal) C++17
0 / 100
151 ms 1364 KB
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pdd pair<double, double>
#define endl '\n'

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int N;
    cin >> N;

    auto calc_r = [](pdd &a, double x) {
        return ((x - a.first)*(x - a.first))/(4*a.second);
    };

    stack<pdd> st;
    for(int i = 0; i < N; i++) {
        double x, r;
        cin >> x >> r;

        double max_r = r;
        while(!st.empty()) {
            pdd tp = st.top();

            max_r = min(max_r, calc_r(tp, x));
            if(max_r >= tp.second)
                st.pop();
            else break;
        }
        st.push({x, max_r});
        cout << setprecision(4) << max_r << endl;
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 5th numbers differ - expected: '17.1630000000', found: '17.1600000000', error = '0.0030000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 1st numbers differ - expected: '247294217.0000000000', found: '247300000.0000000000', error = '5783.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 314th numbers differ - expected: '10.1250000000', found: '10.1200000000', error = '0.0050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 344 KB 2nd numbers differ - expected: '122.0020000000', found: '122.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 16 ms 348 KB 50th numbers differ - expected: '159.0020000000', found: '159.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 38 ms 852 KB 1st numbers differ - expected: '15399.0000000000', found: '15400.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 1092 KB 285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 90 ms 1104 KB 511th numbers differ - expected: '4494.0050000000', found: '4494.0000000000', error = '0.0050000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 123 ms 1108 KB 164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 151 ms 1364 KB 248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000'
2 Halted 0 ms 0 KB -