Submission #1016364

# Submission time Handle Problem Language Result Execution time Memory
1016364 2024-07-07T23:55:04 Z cryptobunny Balloons (CEOI11_bal) C++14
100 / 100
446 ms 12112 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<long double> r(n), x(n);
    cout << fixed << setprecision(3);
    for (int i = 0; i < n; i++) cin >> x[i] >> r[i];
    stack<int> s;
    for (int i = 0; i < n; i++) {
        if (s.empty()) {
            s.push(i);
            cout << r[i] << endl;
        } else {
            while (!s.empty()) {
                long double lim = (x[i] - x[s.top()]) * (x[i] - x[s.top()]) / 4 / r[s.top()];
                r[i] = min(lim, r[i]);
                if (r[s.top()] < r[i]) {
                    s.pop();
                    continue;
                }
                break;
            }
            cout << r[i] << endl;
            s.push(i);
        }
    }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 10 numbers
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB 2 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 4 ms 524 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1112 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 96 ms 2384 KB 50000 numbers
2 Correct 106 ms 3228 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 212 ms 4436 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 232 ms 4976 KB 115362 numbers
2 Correct 234 ms 7504 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 303 ms 6556 KB 154271 numbers
2 Correct 446 ms 12112 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 404 ms 8492 KB 200000 numbers
2 Correct 384 ms 12112 KB 199945 numbers