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 double ld;
ld get_rad(ld x1, ld r1, ld x2){
return (x2 - x1) * (x2 - x1) / (4 * r1);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
stack<pair<int,ld>>st;
for(int i = 0; i < n; i++){
int x2;
ld r;
cin>>x2>>r;
while(st.size()){
int x1 = st.top().first;
ld r1 = st.top().second;
r=min(r,get_rad(x1,r1,x2));
if(r>=r1)st.pop();
else{
cout<<fixed<<setprecision(3)<<r<<'\n';
st.push({x2,r});
break;
}
}
if(st.empty()){
cout<<fixed<<setprecision(3)<<r<<'\n';
st.push({x2,r});
}
}
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... |