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 int long long
using namespace std;
struct Bal{
int x;
double max_r;
};
const int N = 2e5, inf = 1e18;
Bal bals[N];
double calc_rayon(Bal a, Bal b){
double dist = a.x-b.x;
return dist*dist/4.0/a.max_r;
}
int32_t main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.precision(3);
cout << fixed;
int n;
cin >> n;
for (int i=0; i<n; ++i){
cin >> bals[i].x >> bals[i].max_r;
}
stack<Bal> st;
for (int i=0; i<n; ++i){
double crt_ans = bals[i].max_r;
while (!st.empty()){
Bal f = st.top();
crt_ans = min(crt_ans,calc_rayon(f,bals[i]));
if (crt_ans > f.max_r) st.pop();
else break;
}
st.push({bals[i].x,crt_ans});
cout << crt_ans << '\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... |