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 namespace std;
using ld = long double;
using ld2 = array<ld, 2>;
ld rad(ld2 prev, ld x) {
return ((prev[0]-x)*(prev[0]-x)/(4*prev[1]));
}
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
// solve
stack<ld2> check;
while (n--) {
ld x, r;
cin >> x >> r;
while (!check.empty()) {
ld2 prev = check.top();
ld to_prev = rad(prev, x);
r = min(r, to_prev);
if (r >= prev[1]) check.pop();
else break;
}
check.push({x, r});
printf("%.3Lf\n", r);
}
}
# | 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... |