#include <bits/stdc++.h>
#define s second
#define f first
using namespace std;
const int N = 200005;
long double a[N],b[N];
stack <pair<long double,long double> > st;
int main() {
ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
int n;
cin>>n;
for (int i = 1; i <= n; i++)
cin>>a[i]>>b[i];
printf("%.3Lf\n",b[1]);
st.push({a[1],b[1]});
for (int i = 2; i <= n; i++){
long double x = a[i],r = b[i];
while(st.size()){
long double R = st.top().s,X = st.top().f;
long double y = ((x - X)*(x - X))/(4*R);
r = min(r,y);
if (r >= R) st.pop();
else break;
}
st.push({a[i],r});
printf("%.3Lf\n",r);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
1324 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
56 ms |
3372 KB |
50000 numbers |
2 |
Correct |
52 ms |
3228 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
115 ms |
6008 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
135 ms |
6876 KB |
115362 numbers |
2 |
Correct |
122 ms |
7088 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
238 ms |
9032 KB |
154271 numbers |
2 |
Correct |
225 ms |
11704 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
244 ms |
11012 KB |
200000 numbers |
2 |
Correct |
228 ms |
11708 KB |
199945 numbers |