#include <iostream>
#include <stack>
using namespace std;
int coordinates[200000];
long double radius[200000];
long double compute_formula(int coordinate1, int coordinate2, long double r) {
long double l = (coordinate2 - coordinate1) / 2.;
return l * l / r;
}
int main() {
int n;
cin >> n;
for(int i = 0; i < n; ++i) {
cin >> coordinates[i];
cin >> radius[i];
}
stack<int> st;
for(int i = 0; i < n; ++i) {
long double max_rad = 10000000;
while(!st.empty()) {
int j = st.top();
int coordinate_j = coordinates[j], radius_j = radius[j];
max_rad = compute_formula(coordinate_j, coordinates[i] ,radius_j);
if(max_rad < radius[i]) st.pop();
else {
break;
}
}
if(max_rad < radius[i]) {
radius[i] = max_rad;
}
printf("%.3Lf\n", radius[i]);
st.emplace(i);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
4th numbers differ - expected: '1.8420000000', found: '87.0000000000', error = '85.1580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st numbers differ - expected: '247294217.0000000000', found: '10000000.0000000000', error = '237294217.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
3304 KB |
11th numbers differ - expected: '201.0010000000', found: '202.0000000000', error = '0.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
3932 KB |
5th numbers differ - expected: '15395.0000000000', found: '15396.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
73 ms |
5456 KB |
14th numbers differ - expected: '7919.0000000000', found: '7920.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
86 ms |
5712 KB |
5th numbers differ - expected: '5054.0000000000', found: '5055.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
116 ms |
6996 KB |
15th numbers differ - expected: '1860.0000000000', found: '1861.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
140 ms |
8780 KB |
11th numbers differ - expected: '2951.0000000000', found: '2952.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |