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;
const int mxN = 2e5;
int n;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
cout << fixed << setprecision(3);
stack<pair<int, double>> st;
for (int i=0, x, r; i<n; ++i) {
cin >> x >> r;
double mr = r;
while (!st.empty()) {
int tx = st.top().first;
double tr = st.top().second;
double dx = x - tx;
mr = min(mr, dx * dx / (4 * tr));
if (mr >= tr)
st.pop();
else
break;
}
st.push({x, mr});
cout << mr << '\n';
}
}
# | 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... |