# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1176057 | qs1 | Balloons (CEOI11_bal) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define ld long double
#define mp make_pair
int main(){
lli x;
ld a,r,mn;
stack<pair<ld,ld>>v;//{x,radius/y}
cin>>x;
cout<<setprecision(16);
while(x--){
cin>>a>>r;
mn=999999999;
while(!v.empty()&&(a-v.top().first)/(4)/(v.top().second)*(a-v.top().first)>=v.top().second){
mn=min(mn,(a-v.top().first)/(4)/(v.top().second)*(a-v.top().first);
v.pop();
}
r=min(r,mn);
if(v.empty()){
cout<<r<<endl;
}
else{
r=min(r,(a-v.top().first)/(4)/(v.top().second)*(a-v.top().first));
cout<<r<<endl;
}
v.push(mp(a,r));
}
}