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 <iostream>
#include <stack>
using namespace std;
int coordinates[200000];
long double radius[200000];
long double compute_formula(int coordinate1, int coordinate2, long double r) {
long double l = (coordinate2 - coordinate1) / 2.;
return l * l / r;
}
int main() {
int n;
cin >> n;
for(int i = 0; i < n; ++i) {
cin >> coordinates[i];
cin >> radius[i];
}
stack<int> st;
for(int i = 0; i < n; ++i) {
long double max_rad = 1e10;
while(!st.empty()) {
int j = st.top();
int coordinate_j = coordinates[j];
long double radius_j = radius[j];
max_rad = compute_formula(coordinate_j, coordinates[i] ,radius_j);
if(max_rad < radius[i]) st.pop();
else {
break;
}
}
if(max_rad < radius[i]) {
radius[i] = max_rad;
}
printf("%.3Lf\n", radius[i]);
st.emplace(i);
}
}
# | 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... |