Submission #788310

# Submission time Handle Problem Language Result Execution time Memory
788310 2023-07-20T05:45:20 Z math_pi Balloons (CEOI11_bal) C++14
100 / 100
207 ms 8568 KB
#include<bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);


    int n; 
    cin >> n;
    double x[n], r[n];

    stack<int> st;
    for(int i=0; i<n; i++) {
        cin >> x[i] >> r[i];
        while(!st.empty()) {
            double br = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4 * r[st.top()]);
            r[i] = min(r[i], br);
            if(r[st.top()] <= r[i]) st.pop();
            else break;
        }
        st.push(i);
        cout << fixed << setprecision(3) << r[i] << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 21 ms 704 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1492 KB 50000 numbers
2 Correct 40 ms 2328 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 85 ms 2696 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 99 ms 3152 KB 115362 numbers
2 Correct 94 ms 5224 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 134 ms 4008 KB 154271 numbers
2 Correct 157 ms 8568 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 207 ms 4936 KB 200000 numbers
2 Correct 165 ms 8452 KB 199945 numbers