Submission #1086341

# Submission time Handle Problem Language Result Execution time Memory
1086341 2024-09-10T09:13:59 Z SnowRaven52 Balloons (CEOI11_bal) C++17
100 / 100
412 ms 14928 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
    // freopen("main.in", "r", stdin);
    // freopen(".out", "w", stdout);
    long long n; cin >> n;
    long double x[n], r[n], r_f[n];
    for (long long i = 0; i < n; i++) cin >> x[i] >> r[i];
    stack<long long> st;
    for (long long i = 0; i < n; i++){
        while (st.size()) {
            long double rad = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4 * r_f[st.top()]);
            r[i] = min(r[i], rad);
            if (r[i] >= r_f[st.top()]) {
                st.pop();
                continue;
            } else break;
        }
        r_f[i] = r[i];
        st.push(i);
    }
    cout << fixed << setprecision(3);
    for (long long i = 0; i < n; i++) cout << r_f[i] << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 9 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 48 ms 1624 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 101 ms 3876 KB 50000 numbers
2 Correct 106 ms 4008 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 201 ms 7276 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 236 ms 8632 KB 115362 numbers
2 Correct 241 ms 9128 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 333 ms 11344 KB 154271 numbers
2 Correct 409 ms 14928 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 399 ms 13908 KB 200000 numbers
2 Correct 412 ms 14748 KB 199945 numbers