//in the neme of god
#include <bits/stdc++.h>
using namespace std;
stack <int> st;
const int MAX_N = 2e5 + 10;
double n, x[MAX_N], r[MAX_N], ans[MAX_N];
int main(){
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x[i] >> r[i];
ans[i] = r[i];
while (st.size()) {
double tmp = (x[i] - x[st.top()]) * (x[i] - x[st.top()]) / (4. * ans[st.top()]);
ans[i] = min(ans[i], tmp);
if (ans[st.top()] < ans[i])
st.pop();
else
break;
}
st.push(i);
}
for (int i = 0; i < n; i++)
cout << fixed << setprecision(3) << ans[i] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
1352 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
29 ms |
2640 KB |
50000 numbers |
2 |
Correct |
27 ms |
2904 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
4932 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
69 ms |
5712 KB |
115362 numbers |
2 |
Correct |
78 ms |
6484 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
97 ms |
7512 KB |
154271 numbers |
2 |
Correct |
106 ms |
10580 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
124 ms |
8904 KB |
200000 numbers |
2 |
Correct |
110 ms |
10576 KB |
199945 numbers |