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;
using ld = long double;
const ld w = 0.0001;
ld solve(int x1, int x2, ld r2){
return ((x2 - x1)*(x2 - x1))/(4*r2) - w;
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int n; cin >> n;
stack<pair<ld, ld>> q;
for(int i=1; i<=n; i++){
ld x, r; cin >> x >> r;
while(!q.empty() && q.top().second <= r){
r = min(r, solve(x, q.top().first, q.top().second));
q.pop();
}
if(!q.empty()) r = min(r, solve(x, q.top().first, q.top().second));
cout << fixed << setprecision(3) << r << "\n";
q.push({x, 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... |