이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |