#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;
vector<stack_element> elements(n);
for (int i = 0; i < n; i++)
{
cin >> elements[i].x >> elements[i].radius;
double new_x = elements[i].x, max_radius = elements[i].radius;
for (int j = 0; j < i; j++)
{
double prev_radius = elements[j].radius;
double prev_x = elements[j].x;
double dx = (prev_x - new_x);
double radius_to_intersect = (dx * dx / (2.0 * prev_radius)) / 2.0;
if (radius_to_intersect < max_radius)
{
max_radius = radius_to_intersect;
}
}
cout << fixed << setprecision(5);
cout << max_radius << "\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 |
0 ms |
204 KB |
5th numbers differ - expected: '17.1630000000', found: '4.3706900000', error = '12.7923100000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
5th numbers differ - expected: '0.1170000000', found: '0.0833300000', error = '0.0336700000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
356 KB |
3rd numbers differ - expected: '121.0000000000', found: '120.0182900000', error = '0.9817100000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
402 ms |
804 KB |
3rd numbers differ - expected: '211.0000000000', found: '210.0105600000', error = '0.9894400000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2083 ms |
1508 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2074 ms |
2240 KB |
Time limit exceeded |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2085 ms |
2596 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2096 ms |
3204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2092 ms |
3856 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |