#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main(){
cout << fixed << setprecision(3);
int n;
cin >> n;
stack<pair<int,int>> s;
int x,r;
vector<long double> v;
for(int i = 0;i < n;i++){
cin >> x >> r;
long double radius;
while(!s.empty() and (s.top()).first + (s.top()).second >= x - r and r >= (s.top()).second){
s.pop();
}
if(!s.empty() and (s.top()).first + (s.top()).second >= x - r and r <= (s.top()).second){
radius = (((s.top()).first - x)*((s.top()).first - x))/(4.0*(s.top()).second);
}
else{
radius = r;
}
if(radius > r){
radius = r;
}
v.push_back(radius);
s.push(make_pair(x,radius));
}
for(int i = 0;i < n;i++){
if(i != n - 1){
cout << v[i] << "\n";
}
else{
cout << v[i];
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
1096 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
75 ms |
2280 KB |
2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
157 ms |
4384 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
173 ms |
5000 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
238 ms |
6636 KB |
2nd numbers differ - expected: '1873.0000000000', found: '1874.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
301 ms |
7944 KB |
2nd numbers differ - expected: '2961.0000000000', found: '2962.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |