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(){
ios::sync_with_stdio(0), cin.tie(0);
int n; cin >> n;
int x[n];
double r[n];
for (int i = 0; i < n; ++i){
cin >> x[i] >> r[i];
}
stack<int> st;
for (int i = 0; i < n; ++i){
while (!st.empty()) {
int dx = x[i]-x[st.top()];
r[i] = min(r[i], 1.0*dx*dx/(4*r[st.top()]));
if (r[i] >= r[st.top()]) {
st.pop();
} else break;
}
st.push(i);
}
cout << fixed << setprecision(3);
for (int i = 0; i < n; ++i){
cout << r[i] << "\n";
}
return 0;
}
# | 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... |