#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pdd pair<double, double>
#define endl '\n'
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int N;
cin >> N;
auto calc_r = [](pdd &a, double x) {
return ((x - a.first)*(x - a.first))/(4*a.second);
};
stack<pdd> st;
for(int i = 0; i < N; i++) {
double x, r;
cin >> x >> r;
double max_r = r;
while(!st.empty()) {
pdd tp = st.top();
max_r = min(max_r, calc_r(tp, x));
if(max_r >= tp.second)
st.pop();
else break;
}
st.push({x, max_r});
cout << setprecision(3) << max_r << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
2nd numbers differ - expected: '4.1670000000', found: '4.1700000000', error = '0.0030000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
1st numbers differ - expected: '247294217.0000000000', found: '247000000.0000000000', error = '294217.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
9th numbers differ - expected: '1.2780000000', found: '1.2800000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
344 KB |
2nd numbers differ - expected: '122.0020000000', found: '122.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
15 ms |
540 KB |
50th numbers differ - expected: '159.0020000000', found: '159.0000000000', error = '0.0020000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
39 ms |
944 KB |
1st numbers differ - expected: '15399.0000000000', found: '15400.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
78 ms |
1292 KB |
1st numbers differ - expected: '7938.0000000000', found: '7940.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
96 ms |
1364 KB |
2nd numbers differ - expected: '5059.0000000000', found: '5060.0000000000', error = '1.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
120 ms |
1616 KB |
1st numbers differ - expected: '1874.0000000000', found: '1870.0000000000', error = '4.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
156 ms |
1620 KB |
1st numbers differ - expected: '2962.0000000000', found: '2960.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |