#include <iostream>
#include <iomanip>
using namespace std;
#include <vector>
vector <pair<long long,long double>> v;
long double fis,r;
long long 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("%.6Lf\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("%.6Lf\n",m);
v.push_back(make_pair(x,m));
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '1000000000.0000000000', error = '747264614.5620000362' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
384 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
86 ms |
700 KB |
2953rd numbers differ - expected: '1030.4380000000', found: '4752.0000000000', error = '3721.5620000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
225 ms |
1776 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 |
461 ms |
2932 KB |
7271st numbers differ - expected: '7938.8510000000', found: '7947.0000000000', error = '8.1490000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
532 ms |
3440 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 |
736 ms |
4588 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 |
891 ms |
4988 KB |
2785th numbers differ - expected: '2962.3630000000', found: '2984.0000000000', error = '21.6370000000' |
2 |
Halted |
0 ms |
0 KB |
- |