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;
int main() {
int n;
cin >> n;
vector<long double> r(n), x(n);
cout << fixed << setprecision(3);
for (int i = 0; i < n; i++) cin >> x[i] >> r[i];
stack<int> s;
for (int i = 0; i < n; i++) {
if (s.empty()) {
s.push(i);
cout << r[i] << endl;
} else {
while (!s.empty()) {
long double lim = (x[i] - x[s.top()]) * (x[i] - x[s.top()]) / 4 / r[s.top()];
r[i] = min(lim, r[i]);
if (r[s.top()] < r[i]) {
s.pop();
continue;
}
break;
}
cout << r[i] << endl;
s.push(i);
}
}
}
# | 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... |