Submission #1011149

# Submission time Handle Problem Language Result Execution time Memory
1011149 2024-06-30T00:51:57 Z vjudge1 Balloons (CEOI11_bal) C++17
100 / 100
128 ms 7764 KB
#include <bits/stdc++.h>
using i64 = long long;

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

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

    std::vector<std::tuple<int, double>> s;
    for (int i = 0; i < n; i++) {
        while (s.size()) {
            auto [x1, r1] = s.back();
            r[i] = std::min(r[i], 1.0 * (x[i] - x1) * (x[i] - x1) / 4 / r1);
            if (r[i] >= r1) {
                s.pop_back();
            } else {
                break;
            }
        }
        s.push_back({x[i], r[i]});
    }

    for (int i = 0; i < n; i++) {
        std::cout << std::fixed << std::setprecision(3) << r[i] << "\n";
    }

    return 0;
}
# 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 344 KB 505 numbers
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB 2000 numbers
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1116 KB 20000 numbers
# Verdict Execution time Memory Grader output
1 Correct 26 ms 2272 KB 50000 numbers
2 Correct 30 ms 2392 KB 49912 numbers
# Verdict Execution time Memory Grader output
1 Correct 55 ms 4120 KB 100000 numbers
# Verdict Execution time Memory Grader output
1 Correct 62 ms 4820 KB 115362 numbers
2 Correct 57 ms 4944 KB 119971 numbers
# Verdict Execution time Memory Grader output
1 Correct 82 ms 5968 KB 154271 numbers
2 Correct 94 ms 7764 KB 200000 numbers
# Verdict Execution time Memory Grader output
1 Correct 128 ms 7028 KB 200000 numbers
2 Correct 94 ms 7764 KB 199945 numbers