#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(){
int n;
cin >> n;
stack<pair<int,int>> s;
int x,r;
vector<long double> v;
for(int i = 0;i < n;i++){
cin >> x >> r;
long double radius;
while(!s.empty() and get_min((((long double)(((s.top()).first - x)*((s.top()).first - x)))/(4.000*(s.top()).second)),r) >= s.top().second){
s.pop();
}
if(!s.empty()){
radius = (((long double)(((s.top()).first - x)*((s.top()).first - x)))/(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++){
cout << fixed << setprecision(3);
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 |
8th numbers differ - expected: '8.7410000000', found: '9.0910000000', error = '0.3500000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
2nd numbers differ - expected: '252735385.4379999936', found: '0.9330000000', error = '252735384.5049999952' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
204 KB |
6th numbers differ - expected: '213.0000000000', found: '238.0000000000', error = '25.0000000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
332 KB |
3rd numbers differ - expected: '121.0000000000', found: '121.0020000000', error = '0.0020000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
28 ms |
840 KB |
44th numbers differ - expected: '165.0000000000', found: '165.0020000000', error = '0.0020000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
1656 KB |
4th numbers differ - expected: '15396.0000000000', found: '-8148.5510000000', error = '23544.5510000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
161 ms |
2992 KB |
162nd numbers differ - expected: '7765.0000000000', found: '-68368.0840000000', error = '76133.0840000000' |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
194 ms |
3376 KB |
510th numbers differ - expected: '4505.0010000000', found: '-17323.6360000000', error = '21828.6370000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
237 ms |
4440 KB |
161st numbers differ - expected: '1703.0000000000', found: '-291087.1430000000', error = '292790.1430000000' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
295 ms |
5544 KB |
248th numbers differ - expected: '2694.0020000000', found: '-179710.5500000000', error = '182404.5520000000' |
2 |
Halted |
0 ms |
0 KB |
- |