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 <stack>
#include <iomanip>
using namespace std;
double res[1000005];
int main() {
int n;
cin >> n;
stack<pair<double, double>> s;
for (int i = 0; i < n; i++){
double x, r, mi;
cin >> x >> r;
mi = r;
while (!s.empty()) {
pair<double, double> p = s.top();
mi = min(mi, (p.first - x) * (p.first - x) / (p.second * 4));
if (mi >= p.second) {
s.pop();
}
else break;
}
s.push(make_pair(x, mi));
res[i] = mi;
}
cout << fixed << setprecision(3);
for (int i = 0; i < n; i++) {
cout << res[i] << endl;
}
}
# | 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... |