#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
int n; cin >> n;
cout << fixed << setprecision(3);
stack<ld> st;
stack<int> xs;
int x; ld r; cin >> x >> r;
st.push(r);
xs.push(x);
cout << r << "\n";
for (int i = 0; i < n-1; i++) {
cin >> x >> r;
r = min(r, ((ld)xs.top()-x)*((ld)xs.top()-x)/(4*st.top()));
while (!st.empty() && r > st.top()) {
st.pop();
xs.pop();
if (st.empty()) break;
r = min(r, ((ld)xs.top()-x)*((ld)xs.top()-x)/(4*st.top()));
}
cout << r << "\n";
st.push(r);
xs.push(x);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
212 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
312 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
57 ms |
700 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
164 ms |
1672 KB |
50000 numbers |
2 |
Correct |
160 ms |
2168 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
300 ms |
2892 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
369 ms |
3244 KB |
115362 numbers |
2 |
Correct |
354 ms |
4536 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
465 ms |
4068 KB |
154271 numbers |
2 |
Correct |
592 ms |
7392 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
578 ms |
4520 KB |
200000 numbers |
2 |
Correct |
588 ms |
7564 KB |
199945 numbers |