#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(3);
int n;
cin >> n;
vector<pair<int, double>> v;
while(n--) {
int x;
double r;
cin >> x >> r;
auto d=[x](pair<int, double> p) {
double dx=x-p.first;
return dx*dx/(4*p.second);
};
while(v.size()>=2&&d(v.end()[-1])>=d(v.end()[-2]))
v.pop_back();
double h=v.size()?min(r, d(v.back())):r;
cout << h << "\n";
while(v.size()&&h>=v.back().second)
v.pop_back();
v.emplace_back(x, h);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
53rd numbers differ - expected: '213.0000000000', found: '235.0000000000', error = '22.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
384 KB |
4165th numbers differ - expected: '463.3780000000', found: '468.0000000000', error = '4.6220000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
1024 KB |
26317th numbers differ - expected: '1.1140000000', found: '16.4820000000', error = '15.3680000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
116 ms |
1372 KB |
7458th numbers differ - expected: '1.9040000000', found: '8.0000000000', error = '6.0960000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
131 ms |
1636 KB |
4889th numbers differ - expected: '0.7110000000', found: '8.0000000000', error = '7.2890000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
184 ms |
1844 KB |
40692nd numbers differ - expected: '5543.6460000000', found: '5559.0000000000', error = '15.3540000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
215 ms |
1944 KB |
4263rd numbers differ - expected: '0.6980000000', found: '4.0000000000', error = '3.3020000000' |
2 |
Halted |
0 ms |
0 KB |
- |