Submission #1026798

# Submission time Handle Problem Language Result Execution time Memory
1026798 2024-07-18T11:25:08 Z JohnnyVenturas Balloons (CEOI11_bal) C++17
10 / 100
126 ms 5976 KB
#include <iostream>
#include <stack>

using namespace std;

int coordinates[200000];
long double radius[200000];

long double compute_formula(int coordinate1, int coordinate2, long double r) {
        long double l = (coordinate2 - coordinate1) / 2.;
        return l * l / r;
}

int main() {
        int n;
        cin >> n;
        for(int i = 0; i < n; ++i) {
                cin >> coordinates[i];
                cin >> radius[i];
        }

        stack<int> st;

        for(int i = 0; i < n; ++i) {
                long double max_rad = 1e10;
                while(!st.empty()) {
                        int j = st.top();
                        int coordinate_j = coordinates[j];
                        long double radius_j = radius[j];
                        max_rad = compute_formula(coordinate_j, coordinates[i] ,radius_j);
                        if(max_rad < radius[i]) st.pop();
                        else {
                                break;
                        }
                }

                if(max_rad < radius[i]) {
                        radius[i] = max_rad;
                }
                printf("%.3Lf\n", radius[i]);
                st.emplace(i);

        }

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB 3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 6th numbers differ - expected: '116.0020000000', found: '117.0000000000', error = '0.9980000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 2904 KB 11th numbers differ - expected: '201.0010000000', found: '202.0000000000', error = '0.9990000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 3152 KB 5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 3924 KB 14th numbers differ - expected: '7919.0000000000', found: '7920.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 4040 KB 5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 4692 KB 15th numbers differ - expected: '1860.0000000000', found: '1861.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 126 ms 5976 KB 11th numbers differ - expected: '2951.0000000000', found: '2952.0000000000', error = '1.0000000000'
2 Halted 0 ms 0 KB -