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 <iomanip>
#include <iostream>
#include <vector>
struct sphere {
double x, max_r;
};
int n;
std::vector<sphere> v;
std::vector<double> dists;
int main() {
std::cin >> n;
v = std::vector<sphere>(n);
dists = std::vector<double>(n);
for (int i = 0; i < n; i++) {
std::cin >> v[i].x >> v[i].max_r;
}
dists[0] = static_cast<double>(v[0].max_r);
for (int i = 1; i < n; i++) {
double min_r = v[i].max_r;
for (int j = 0; j < i; j++) {
min_r = std::min(min_r, ((v[i].x - v[j].x) * (v[i].x - v[j].x)) /
(4 * v[j].max_r));
}
dists[i] = min_r;
}
for (double d : dists)
std::cout << std::fixed << std::setprecision(3) << d << '\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... |