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 <math.h>
#include <stack>
#include <iomanip>
using namespace std;
#define ld long double
const int MX = 2e5 + 5;
const ld eps = 1e-10;
int n;
struct ball{
int ps;
ld r;
};
stack<ball> s;
int main(){
cin.tie(0) -> sync_with_stdio(0);
cin >> n;
for(int p, r, i = 0; i < n; i ++){
cin >> p >> r;
ld mxR = r;
while(!s.empty()){
ld c = (s.top().ps - p) * 1.0L * (s.top().ps - p);
mxR = min(mxR, c / (4.0L * s.top().r));
if(mxR > s.top().r - eps)
s.pop();
else
break;
}
cout << fixed << setprecision(3) << mxR << endl;
s.push((ball){p, mxR});
}
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... |