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;
typedef long long ll;
typedef long double ld;
int main() {
int n; cin >> n;
cout << fixed << setprecision(3);
stack<ld> st;
stack<int> xs;
int x; ld r; cin >> x >> r;
st.push(r);
xs.push(x);
cout << r << "\n";
for (int i = 0; i < n-1; i++) {
cin >> x >> r;
r = min(r, ((ld)xs.top()-x)*((ld)xs.top()-x)/(4*st.top()));
while (!st.empty() && r > st.top()) {
st.pop();
xs.pop();
if (st.empty()) break;
r = min(r, ((ld)xs.top()-x)*((ld)xs.top()-x)/(4*st.top()));
}
cout << r << "\n";
st.push(r);
xs.push(x);
}
}
# | 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... |