#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
double get_min(double x1,double x2){
if(x1 > x2){
return x2;
}
return x1;
}
int main(){
int n;
cin >> n;
stack<pair<int,double>> s;
int x,r;
vector<long double> v;
for(int i = 0;i < n;i++){
cin >> x >> r;
long double radius;
if(s.empty()){
radius = r;
v.push_back(radius);
s.push(make_pair(x,radius));
continue;
}
while(!s.empty() and (s.top()).first + (s.top()).second >= x - r){
radius = get_min((((pow((s.top()).first - x,2)))/(4.000*(s.top()).second)),r);
if(radius > s.top().second){
s.pop();
}
else{
break;
}
}
v.push_back(radius);
s.push(make_pair(x,radius));
}
for(int i = 0;i < n;i++){
cout << fixed << setprecision(5);
if(i != n - 1){
cout << v[i] << "\n";
}
else{
cout << v[i];
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
3rd numbers differ - expected: '49.0000000000', found: '4.1666700000', error = '44.8333300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
3rd numbers differ - expected: '0.0420000000', found: '0.0011700000', error = '0.0408300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
332 KB |
4th numbers differ - expected: '117.0000000000', found: '121.0000300000', error = '4.0000300000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
892 KB |
9th numbers differ - expected: '202.0000000000', found: '206.0011700000', error = '4.0011700000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
1984 KB |
3rd numbers differ - expected: '15396.0000000000', found: '15398.0000200000', error = '2.0000200000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
165 ms |
3936 KB |
10th numbers differ - expected: '7926.0000000000', found: '7930.0000000000', error = '4.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
191 ms |
4392 KB |
3rd numbers differ - expected: '5055.0000000000', found: '5059.0000500000', error = '4.0000500000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
265 ms |
5784 KB |
13th numbers differ - expected: '1861.0000000000', found: '1863.0001300000', error = '2.0001300000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
318 ms |
6660 KB |
9th numbers differ - expected: '2952.0000000000', found: '2955.0000800000', error = '3.0000800000' |
2 |
Halted |
0 ms |
0 KB |
- |