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;
typedef long long ll;
int main(){
int n;
cin >> n;
pair<double, double> v[n];
for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
stack<pair<double, double>> s;
for (int i = 0; i < n; i++){
double radius = v[i].second;
double x2 = v[i].first;
while (!s.empty()){
double x1 = s.top().first, r1 = s.top().second;
double r2 = (x1-x2)*(x1-x2)/(4*r1);
radius = min(r2, radius);
if (r2 > r1){
s.pop();
}else{
break;
}
}
cout << setprecision(6) << radius << endl;
s.push(make_pair(x2, radius));
}
}
# | 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... |