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 <iomanip>
#include <vector>
using namespace std;
typedef long double lint;
lint dist(lint p1, lint p2, lint r1){
return (p1-p2)*(p1-p2)/4/r1;
}
int main() {
int n;
cin >> n;
lint pos[n], maxr[n], rad[n];
for (int x = 0; x < n; x ++){
cin >> pos[x] >> maxr[x];
}
vector<int> stack;
for (int x = 0; x < n; x ++){
rad[x] = maxr[x];
while (!stack.empty()){
int y = stack.back();
rad[x] = min(dist(pos[y], pos[x], rad[y]), rad[x]);
if (rad[x] > rad[y]){
stack.pop_back();
}else {
break;
}
}
stack.push_back(x);
}
for (int x = 0; x < n; x ++){
cout << fixed << setprecision(3) << rad[x] << endl;
}
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... |