Submission #788308

# Submission time Handle Problem Language Result Execution time Memory
788308 2023-07-20T05:37:56 Z math_pi Balloons (CEOI11_bal) C++14
10 / 100
167 ms 6048 KB
#include<bits/stdc++.h>
using namespace std;

double calc(pair<double, double> p, double x) {
    return (p.first - x) * (p.first - x) / (4 * p.second);
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    int n;
    cin >> n;

    vector<double> res(n);
    stack<pair<double, double>> st;
    for(int i=0; i<n; i++) {
        double x, r;
        cin >> x >> r;
        double max_r = r;
        while(!st.empty()) {
            pair<double, double> last = st.top();
            double last_r = calc(last, x);

            max_r = min(max_r, last_r);

            if(max_r >= last.second) {
                st.pop();
                continue;
            } else break;
        }
        
        res[i] = max_r;
        st.push({x, r});
    }

    cout << fixed << setprecision(3);

    for(auto &x: res) 
        cout << x << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 5th numbers differ - expected: '17.1630000000', found: '4.3710000000', error = '12.7920000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB 3rd numbers differ - expected: '0.0420000000', found: '2.0830000000', error = '2.0410000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB 3rd numbers differ - expected: '121.0000000000', found: '120.0180000000', error = '0.9820000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 852 KB 3rd numbers differ - expected: '211.0000000000', found: '210.0110000000', error = '0.9890000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 40 ms 1568 KB 3rd numbers differ - expected: '15396.0000000000', found: '9489.3930000000', error = '5906.6070000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 102 ms 3196 KB 3rd numbers differ - expected: '7936.0000000000', found: '6084.6240000000', error = '1851.3760000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 3744 KB 6th numbers differ - expected: '5053.0000000000', found: '5052.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 121 ms 5108 KB 3rd numbers differ - expected: '1872.0000000000', found: '1871.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 167 ms 6048 KB 3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -