#include <iostream>
#include <iomanip>
using namespace std;
#include <math.h>
#include <vector>
vector <pair<int,long double>> v;
long double fis,r;
int x;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++){
cin >> x;
cin >> r;
long double fis;
long double m = r;
while (v.size() && v[v.size()-1].second <= m){
long double o = x - v[v.size()-1].first;
fis = o * o / (4 * v[v.size()-1].second);
m = min(m,fis);
if (v[v.size()-1].second <= m){
v.pop_back();
}
}
if (v.empty()){
printf("%.3Lf\n",r);
v.push_back(make_pair(x,r));
continue;
}
long double o = x - v[v.size()-1].first;
fis = o * o / (4 * v[v.size()-1].second);
m = min(m,fis);
printf("%.3Lf\n",m);
v.push_back(make_pair(x,m));
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
384 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
504 KB |
2953rd numbers differ - expected: '1030.4380000000', found: '4752.0000000000', error = '3721.5620000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
221 ms |
1392 KB |
14045th numbers differ - expected: '15399.0000000000', found: '15419.0000000000', error = '20.0000000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
452 ms |
2552 KB |
7271st numbers differ - expected: '7938.8510000000', found: '7947.0000000000', error = '8.1490000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
524 ms |
2928 KB |
4713th numbers differ - expected: '5060.4220000000', found: '5087.0000000000', error = '26.5780000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
711 ms |
3828 KB |
1766th numbers differ - expected: '1874.0130000000', found: '1903.0000000000', error = '28.9870000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
907 ms |
4472 KB |
2785th numbers differ - expected: '2962.3630000000', found: '2984.0000000000', error = '21.6370000000' |
2 |
Halted |
0 ms |
0 KB |
- |