#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
double get_min(double x1,double x2){
if(x1 > x2){
return x2;
}
return x1;
}
int main(){
long long int n;
cin >> n;
stack<pair<long long int,double>> s;
long long int x,r;
vector<long double> v;
for(int i = 0;i < n;i++){
cin >> x >> r;
long double radius;
if(s.empty()){
radius = r;
v.push_back(radius);
s.push(make_pair(x,radius));
continue;
}
while(!s.empty() and (s.top()).first + (s.top()).second >= x - r){
radius = get_min((((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),r);
if(radius > s.top().second){
s.pop();
}
else{
break;
}
}
v.push_back(radius);
s.push(make_pair(x,radius));
}
for(int i = 0;i < n;i++){
if(i != n - 1){
cout << fixed << setprecision(5)<< v[i] << "\n";
}
else{
cout << fixed << setprecision(5) << v[i];
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
3rd numbers differ - expected: '49.0000000000', found: '4.1666700000', error = '44.8333300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
3rd numbers differ - expected: '0.0420000000', found: '0.0011700000', error = '0.0408300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
332 KB |
4th numbers differ - expected: '117.0000000000', found: '121.0000300000', error = '4.0000300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
32 ms |
888 KB |
9th numbers differ - expected: '202.0000000000', found: '206.0011700000', error = '4.0011700000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
2036 KB |
3rd numbers differ - expected: '15396.0000000000', found: '15398.0000200000', error = '2.0000200000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
176 ms |
3936 KB |
10th numbers differ - expected: '7926.0000000000', found: '7930.0000000000', error = '4.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
267 ms |
4444 KB |
3rd numbers differ - expected: '5055.0000000000', found: '5059.0000500000', error = '4.0000500000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
274 ms |
5804 KB |
13th numbers differ - expected: '1861.0000000000', found: '1863.0001300000', error = '2.0001300000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
358 ms |
6708 KB |
9th numbers differ - expected: '2952.0000000000', found: '2955.0000800000', error = '3.0000800000' |
2 |
Halted |
0 ms |
0 KB |
- |