#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector<int> x(n), r(n);
for (int i=0; i<n; i++){
cin >> x[i] >> r[i];
}
vector<float> res(n);
res[0] = r[0];
int last_idx = 0;
for (int i=1; i<n; i++){
float r1 = float((x[i]-x[i-1]) * (x[i]-x[i-1])) / float(4 * res[i-1]);
float r_last = float((x[i]-x[last_idx]) * (x[i]-x[last_idx])) / float(4 * res[last_idx]);
res[i] = min(float(r[i]), min(r1, r_last));
if(r1 < r_last){
last_idx = i;
}
}
for (float a : res) cout << fixed << setprecision(3) << a << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
5th numbers differ - expected: '17.1630000000', found: '99.0000000000', error = '81.8370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
436 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247294224.0000000000', error = '7.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
8th numbers differ - expected: '0.3800000000', found: '9.0000000000', error = '8.6200000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
504 KB |
114th numbers differ - expected: '39.0180000000', found: '56.0000000000', error = '16.9820000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
852 KB |
196th numbers differ - expected: '100.7250000000', found: '111.0000000000', error = '10.2750000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
110 ms |
1876 KB |
3rd numbers differ - expected: '15396.0000000000', found: '-8140.0220000000', error = '23536.0220000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
242 ms |
3764 KB |
965th numbers differ - expected: '6886.0140000000', found: '6886.0160000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
245 ms |
4208 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
394 ms |
5848 KB |
1730th numbers differ - expected: '5.6890000000', found: '6.8060000000', error = '1.1170000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
474 ms |
6988 KB |
1411th numbers differ - expected: '1420.0190000000', found: '1420.0210000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |