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;
#define int long long
#define double long double
signed main(){
int n; cin>>n;
vector<int> x(n);
vector<double> r(n);
for (int i=0; i<n; i++) cin>>x[i]>>r[i];
stack<int> s;
for (int i=0; i<n; i++){
while (!s.empty()){
r[i] = min(r[i], (double)((x[i]-x[s.top()])*((x[i]-x[s.top()])))/(double)(4*r[s.top()]));
if (r[s.top()]>r[i]) break;
s.pop();
}
s.push(i);
printf("%.3Lf\n", r[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... |