#include <iomanip>
#include <iostream>
#include <stack>
#include <vector>
struct sphere {
double x, max_r;
};
int n;
std::vector<sphere> v;
std::stack<sphere> s;
int main() {
std::cin >> n;
v = std::vector<sphere>(n);
for (int i = 0; i < n; i++) {
std::cin >> v[i].x >> v[i].max_r;
}
for (int i = 0; i < n; i++) {
double min_r = v[i].max_r;
while (!s.empty()) {
sphere prev = s.top();
min_r = std::min(
min_r, (((v[i].x - prev.x) * (v[i].x - prev.x)) / (4 * prev.max_r)));
if (min_r >= prev.max_r)
s.pop();
else
break;
}
s.push(v[i]);
std::cout << std::fixed << std::setprecision(5) << min_r << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
5th numbers differ - expected: '17.1630000000', found: '4.3706900000', error = '12.7923100000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
3rd numbers differ - expected: '0.0420000000', found: '2.0833300000', error = '2.0413300000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
348 KB |
3rd numbers differ - expected: '121.0000000000', found: '120.0182900000', error = '0.9817100000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
23 ms |
1108 KB |
3rd numbers differ - expected: '211.0000000000', found: '210.0105600000', error = '0.9894400000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
71 ms |
1988 KB |
3rd numbers differ - expected: '15396.0000000000', found: '9489.3934600000', error = '5906.6065400000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
121 ms |
4288 KB |
3rd numbers differ - expected: '7936.0000000000', found: '6084.6244400000', error = '1851.3755600000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
157 ms |
4944 KB |
6th numbers differ - expected: '5053.0000000000', found: '5052.0004500000', error = '0.9995500000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
192 ms |
6680 KB |
3rd numbers differ - expected: '1872.0000000000', found: '1871.0012000000', error = '0.9988000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
234 ms |
8032 KB |
3rd numbers differ - expected: '2960.0000000000', found: '2959.0007600000', error = '0.9992400000' |
2 |
Halted |
0 ms |
0 KB |
- |