Submission #1096865

# Submission time Handle Problem Language Result Execution time Memory
1096865 2024-10-05T09:59:09 Z ocasu Balloons (CEOI11_bal) C++17
100 / 100
155 ms 10248 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double



signed main(){
    int n; cin>>n;
    vector<int> x(n);
    vector<double> r(n);
    for (int i=0; i<n; i++) cin>>x[i]>>r[i];

    stack<int> s;
    for (int i=0; i<n; i++){
        while (!s.empty()){
            r[i] = min(r[i], (double)((x[i]-x[s.top()])*((x[i]-x[s.top()])))/(double)(4*r[s.top()]));
            if (r[s.top()]>r[i]) break;
            s.pop();
        }
        s.push(i);
        printf("%.3Lf\n", r[i]);     
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 2 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 14 ms 1116 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 38 ms 2644 KB 50000 numbers
2 Correct 44 ms 2852 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 89 ms 4952 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 99 ms 5712 KB 115362 numbers
2 Correct 93 ms 6304 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 125 ms 7512 KB 154271 numbers
2 Correct 152 ms 10248 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 151 ms 9300 KB 200000 numbers
2 Correct 155 ms 10064 KB 199945 numbers