#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(0), cin.tie(0);
int n; cin >> n;
int x[n], r[n];
for (int i = 0; i < n; ++i){
cin >> x[i] >> r[i];
}
stack<int> st;
double rr[n];
for (int i = 0; i < n; ++i){
while (!st.empty()) {
int dx = x[i]-x[st.top()];
rr[i] = min(1.0*r[i], 1ll*dx*dx/(4*rr[st.top()]));
if (rr[i] >= rr[st.top()]) {
st.pop();
} else break;
}
if (st.empty()) rr[i] = r[i];
else {
int dx = x[i]-x[st.top()];
rr[i] = min(1.0*r[i], 1ll*dx*dx/(4*rr[st.top()]));
}
st.push(i);
}
cout << fixed << setprecision(3);
for (int i = 0; i < n; ++i){
cout << rr[i] << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
332 KB |
79th numbers differ - expected: '36.0070000000', found: '2766.0000000000', error = '2729.9930000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
968 KB |
137th numbers differ - expected: '67.1010000000', found: '3129.0000000000', error = '3061.8990000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
2200 KB |
250th numbers differ - expected: '15134.0000000000', found: '18307.0000000000', error = '3173.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
102 ms |
4124 KB |
162nd numbers differ - expected: '7765.0000000000', found: '14571.0000000000', error = '6806.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
105 ms |
4740 KB |
510th numbers differ - expected: '4505.0010000000', found: '13465.0000000000', error = '8959.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
138 ms |
6344 KB |
161st numbers differ - expected: '1703.0000000000', found: '4036.0000000000', error = '2333.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
207 ms |
7712 KB |
248th numbers differ - expected: '2694.0020000000', found: '8658.0000000000', error = '5963.9980000000' |
2 |
Halted |
0 ms |
0 KB |
- |