#include<bits/stdc++.h>
#define N 200010
#define int long long
#define double long double
using namespace std;
double res[N];
int32_t main(){
int n;
cin >> n;
stack <pair <double, double>> s;
s.push({0, 0});
cout << fixed << setprecision(3);
for(int i = 1;i <= n;i++){
double a, b;
cin >> a >> b;
while(!s.empty()){
auto [x, y] = s.top();
// cout << x << ' ' << y << '\n';
if(y == 0){
res[i] = b;
break;
}
res[i] = min(b, ((a-x)*(a-x))/(4*y));
b = min(b, res[i]);
if(res[i] >= y){
s.pop();
}
else{
// cout << y << "\n";
break;
}
}
s.push({a, res[i]});
}
for(int i = 1;i <= n;i++){
cout << res[i] << '\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
340 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
23 ms |
752 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
58 ms |
1732 KB |
50000 numbers |
2 |
Correct |
59 ms |
2364 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
2940 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
137 ms |
3440 KB |
115362 numbers |
2 |
Correct |
145 ms |
5260 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
181 ms |
4208 KB |
154271 numbers |
2 |
Correct |
255 ms |
8544 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
224 ms |
5044 KB |
200000 numbers |
2 |
Correct |
241 ms |
8536 KB |
199945 numbers |