#include <bits/stdc++.h>
#define f first
#define s second
#define N 200005
#define int long long
using namespace std;
double pos[N],rad[N];
stack<pair<double,double>> st;
double inflate(double x,double r) {
while (!st.empty()) {
double x1 = st.top().f, r1 = st.top().s;
r = min(r, ((x1 - x) * (x1 - x)) / (4 * r1));
if (r >= r1)
st.pop();
else
break;
}
st.push({x, r});
return r;
}
signed main() {
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> pos[i] >> rad[i];
for (int i = 0; i < n; i++)
cout << inflate(pos[i], rad[i]) << setprecision(4) << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
5th numbers differ - expected: '17.1630000000', found: '17.1600000000', error = '0.0030000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247294000.0000000000', error = '217.0000000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
204 KB |
314th numbers differ - expected: '10.1250000000', found: '10.1200000000', error = '0.0050000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
332 KB |
2nd numbers differ - expected: '122.0020000000', found: '122.0000000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
69 ms |
832 KB |
50th numbers differ - expected: '159.0020000000', found: '159.0000000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
178 ms |
2276 KB |
2nd numbers differ - expected: '15398.0000000000', found: '15400.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
368 ms |
3948 KB |
285th numbers differ - expected: '7629.0020000000', found: '7629.0000000000', error = '0.0020000000' |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
410 ms |
4488 KB |
511th numbers differ - expected: '4494.0050000000', found: '4494.0000000000', error = '0.0050000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
539 ms |
5764 KB |
164th numbers differ - expected: '1698.0020000000', found: '1698.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
685 ms |
7128 KB |
248th numbers differ - expected: '2694.0020000000', found: '2694.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |