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 <iostream>
#include <vector>
using namespace std;
#define MAXN 200000
int x[MAXN + 1], r[MAXN + 1], sta[MAXN + 1], st;
double ans[MAXN + 1];
int n;
int eps(double x) {
return x < -1e-10 ? -1 : x > 1e-10;
}
double sqr(double x) {
return x * x;
}
void downdate(double &a, double b){
return (void)((eps(a - b) > 0) ? (a = b) : 0);
}
int main() {
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> x[i] >> r[i];
}
ans[sta[st = 1] = 1] = r[1];
for (int i = 2; i <= n; sta[++st] = i++) {
for (ans[i] = r[i]; st && (downdate(ans[i], sqr(x[i] - x[sta[st]])/(4.0 * ans[sta[st]])), eps(ans[i] - ans[sta[st]]) >= 0); --st);
}
for (int i = 1; i <= n; ++i) {
printf("%.3f\n", ans[i]);
}
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... |