#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 and r <= (s.top()).second){
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
2nd numbers differ - expected: '122.0020000000', found: '123.0000000000', error = '0.9980000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
37 ms |
876 KB |
2nd numbers differ - expected: '212.0010000000', found: '213.0000000000', error = '0.9990000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
88 ms |
1612 KB |
2nd numbers differ - expected: '15398.0000000000', found: '24984.0000000000', error = '9586.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
154 ms |
2808 KB |
2nd numbers differ - expected: '7937.0000000000', found: '10352.0000000000', error = '2415.0000000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
222 ms |
3248 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
238 ms |
4556 KB |
2nd numbers differ - expected: '1873.0000000000', found: '1874.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
368 ms |
5216 KB |
2nd numbers differ - expected: '2961.0000000000', found: '2962.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |