#include <algorithm>
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
using namespace std;
typedef long long ll;
struct stack_element
{
double x, radius;
};
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n; cin >> n;
stack<stack_element> s;
for (int i = 0; i < n; i++)
{
double new_x, max_radius; cin >> new_x >> max_radius;
while (!s.empty())
{
double prev_radius = s.top().radius;
double prev_x = s.top().x;
double dx = (prev_x - new_x);
double radius_to_intersect = (dx*dx / (2 * prev_radius)) / 2.0;
if (radius_to_intersect < max_radius)
{
max_radius = radius_to_intersect;
s.pop();
}
else
break;
}
s.push({ new_x,max_radius });
cout << fixed << setprecision(5);
cout << max_radius << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
27 ms |
748 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
78 ms |
1692 KB |
13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
143 ms |
3012 KB |
7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
174 ms |
3520 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
221 ms |
4680 KB |
1730th numbers differ - expected: '5.6890000000', found: '6.8055600000', error = '1.1165600000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
282 ms |
5672 KB |
2716th numbers differ - expected: '22.1690000000', found: '43.0000000000', error = '20.8310000000' |
2 |
Halted |
0 ms |
0 KB |
- |