#include<bits/stdc++.h>
#define N 200010
#define int long long
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));
// cout << 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 |
Incorrect |
1 ms |
212 KB |
2nd numbers differ - expected: '4.1670000000', found: '49.0000000000', error = '44.8330000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
336 KB |
2nd numbers differ - expected: '0.0010000000', found: '213.0000000000', error = '212.9990000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
376 KB |
4th numbers differ - expected: '117.0000000000', found: '121.0000000000', error = '4.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1056 KB |
9th numbers differ - expected: '202.0000000000', found: '206.0010000000', error = '4.0010000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
142 ms |
2016 KB |
3rd numbers differ - expected: '15396.0000000000', found: '15398.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
287 ms |
3276 KB |
12th numbers differ - expected: '7920.0000000000', found: '7923.0000000000', error = '3.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
347 ms |
3660 KB |
3rd numbers differ - expected: '5055.0000000000', found: '5059.0000000000', error = '4.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
453 ms |
4720 KB |
13th numbers differ - expected: '1861.0000000000', found: '1863.0000000000', error = '2.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
570 ms |
5580 KB |
9th numbers differ - expected: '2952.0000000000', found: '2955.0000000000', error = '3.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |