This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |