Submission #729760

# Submission time Handle Problem Language Result Execution time Memory
729760 2023-04-24T14:10:52 Z vjudge1 Balloons (CEOI11_bal) C++17
100 / 100
562 ms 7000 KB
#include <iostream>
#include <stack>
#include <iomanip>
using namespace std;
double res[1000005];
int main() {
    int n;
    cin >> n;
    stack<pair<double, double>> s;
    for (int i = 0; i < n; i++){
        double x, r, mi;
        cin >> x >> r;
        mi = r;
        while (!s.empty()) {
            pair<double, double> p = s.top();
            mi = min(mi, (p.first - x) * (p.first - x) / (p.second * 4));
            if (mi >= p.second) {
                s.pop();
            }
            else break;
        }
        s.push(make_pair(x, mi));
        res[i] = mi;
    }
    cout << fixed << setprecision(3);
    for (int i = 0; i < n; i++) {
        cout << res[i] << endl;
    }
}
# 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 2 ms 212 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 7 ms 340 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 54 ms 800 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 140 ms 1992 KB 50000 numbers
2 Correct 139 ms 1920 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 280 ms 3532 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 334 ms 4104 KB 115362 numbers
2 Correct 374 ms 4244 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 430 ms 5272 KB 154271 numbers
2 Correct 562 ms 6936 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 551 ms 6108 KB 200000 numbers
2 Correct 560 ms 7000 KB 199945 numbers