#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
long double get_min(long double x1,long double x2){
if(x1 > x2){
return x2;
}
return x1;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
long long int n;
cin >> n;
stack<pair<long long int,double>> s;
long long int x,r;
vector<double> v;
for(int i = 0;i < n;i++){
cin >> x >> r;
double radius = r;
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)),radius);
radius = get_min(radius,r);
if(radius > s.top().second){
s.pop();
}
else{
break;
}
}
// }
// if(!s.empty()){
// radius = (((double)(pow((s.top()).first - x,2)))/(4.000*(s.top()).second));
// }
// else{
// radius = r;
// }
// if(radius > r){
// radius = r;
// }
v.push_back(radius);
s.push(make_pair(x,radius));
}
for(int i = 0;i < n;i++){
if(i != n - 1){
cout << fixed << setprecision(6) << v[i] << "\n";
}
else{
cout << fixed << setprecision(6) << v[i];
}
}
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 |
332 KB |
3rd numbers differ - expected: '0.0420000000', found: '3.0000000000', error = '2.9580000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
399th numbers differ - expected: '9.9760000000', found: '37.0000000000', error = '27.0240000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
20 ms |
968 KB |
1209th numbers differ - expected: '72.2820000000', found: '178.0000000000', error = '105.7180000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
1932 KB |
13945th numbers differ - expected: '0.0140000000', found: '7.0000000000', error = '6.9860000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
104 ms |
3648 KB |
7236th numbers differ - expected: '0.0070000000', found: '7.0000000000', error = '6.9930000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
118 ms |
4288 KB |
4645th numbers differ - expected: '0.0260000000', found: '8.0000000000', error = '7.9740000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
153 ms |
5708 KB |
1736th numbers differ - expected: '0.0050000000', found: '3.0000000000', error = '2.9950000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
185 ms |
6812 KB |
2718th numbers differ - expected: '2.2100000000', found: '3.0000000000', error = '0.7900000000' |
2 |
Halted |
0 ms |
0 KB |
- |