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>
#define ll int
#define ntr "\n"
#define mod (ll)(1e9+7)
#define taskname "BALLOONS"
#define frep freopen(taskname".inp","r",stdin); freopen(taskname".out","w",stdout);
using namespace std;
ll n;
int main(){
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//frep;
cin>>n;
cout<<fixed<<setprecision(3);
stack<pair<ll, double>> st;
for(int i=1;i<=n;i++){
ll x;
double r;
cin>>x>>r;
while(!st.empty()){
pair<ll, double> curr=st.top();
r=min(r,( double)1LL*(x-curr.first)*(x-curr.first)/(4.0*curr.second));
if(r>curr.second){
st.pop();
continue;
}
else{
break;
}
}
st.push({x,r});
cout<<r<<ntr;
}
}
# | 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... |