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 <stack>
#include <vector>
struct sphere {
long double x, max_r;
};
int n;
std::vector<sphere> v;
std::stack<sphere> s;
int main() {
std::cin >> n;
v = std::vector<sphere>(n);
for (int i = 0; i < n; i++) {
std::cin >> v[i].x >> v[i].max_r;
}
for (int i = 0; i < n; i++) {
long double min_r = v[i].max_r;
while (!s.empty()) {
sphere prev = s.top();
min_r = std::min(min_r, ((v[i].x - prev.x) * (v[i].x - prev.x)) /
(4 * prev.max_r));
if (min_r >= prev.max_r)
s.pop();
else
break;
}
s.push(v[i]);
std::cout << std::fixed << std::setprecision(3) << min_r << '\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... |