#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main(){
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){
radius = ((long double)(((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++){
cout << fixed << setprecision(3);
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 |
1 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 |
3rd numbers differ - expected: '121.0000000000', found: '123.0000000000', error = '2.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
868 KB |
3rd numbers differ - expected: '211.0000000000', found: '213.0000000000', error = '2.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
78 ms |
1536 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 |
3028 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
221 ms |
3504 KB |
6th numbers differ - expected: '5053.0000000000', found: '5055.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
245 ms |
4792 KB |
3rd numbers differ - expected: '1872.0000000000', found: '1874.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
304 ms |
5396 KB |
3rd numbers differ - expected: '2960.0000000000', found: '2962.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |