#include <iostream>
#include <stack>
#include <iomanip>
using namespace std;
using ll = long double;
ll n,x,r,rez;
stack<pair<ll,ll>> S; // pozitia si raza pe care o are
int main() {
cin>>n;
cin>>x>>r;
rez+=r;
S.emplace(x,r);
cout<<fixed<<setprecision(3)<<r<<'\n';
for (int i = 2;i<=n;++i) {
cin>>x>>r;
ll crtr = r;
// verificam limitele de dinainte
bool ok = 1;
while(ok&&!S.empty()) {
// calculam radius maxim fata de cercul de dinainte
ll maxr = pow((x-S.top().first),2LL)/(4*S.top().second);
crtr = min(crtr,maxr);
if (S.top().second<=crtr) {
// we can remove it and keep searching
ok = 1;
S.pop();
} else {
//
ok = 0;
}
}
S.emplace(x,crtr);
rez+=crtr;
cout<<fixed<<setprecision(3)<<crtr<<'\n';
}
// cout<<rez;
return 0;
}
Compilation message
bal.cpp: In function 'int main()':
bal.cpp:21:35: error: 'pow' was not declared in this scope
21 | ll maxr = pow((x-S.top().first),2LL)/(4*S.top().second);
| ^~~