Submission #788307

# Submission time Handle Problem Language Result Execution time Memory
788307 2023-07-20T05:32:34 Z math_pi Balloons (CEOI11_bal) C++14
10 / 100
150 ms 6000 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();
            } else break;
        }
        
        res[i] = max_r;
        st.push({x, r});
    }

    cout << fixed << setprecision(3);

    for(auto &x: res) 
        cout << x << ' ';
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 17 ms 932 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 41 ms 1552 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 90 ms 3200 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 91 ms 3740 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 123 ms 5104 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 150 ms 6000 KB 3rd numbers differ - expected: '2960.0000000000', found: '2959.0010000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -