#include <iostream>
#include <math.h>
#include <stack>
#include <iomanip>
using namespace std;
#define ld long double
const int MX = 2e5 + 5;
const ld eps = 1e-10;
int n;
struct ball{
int ps;
ld r;
};
stack<ball> s;
int main(){
cin.tie(0) -> sync_with_stdio(0);
cin >> n;
for(int p, r, i = 0; i < n; i ++){
cin >> p >> r;
ld mxR = r;
while(!s.empty()){
ld c = (s.top().ps - p) * 1.0L * (s.top().ps - p);
mxR = min(mxR, c / (4.0L * s.top().r));
if(mxR > s.top().r - eps)
s.pop();
else
break;
}
cout << fixed << setprecision(3) << mxR << endl;
s.push((ball){p, mxR});
}
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 |
Correct |
2 ms |
204 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
332 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
696 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
135 ms |
1700 KB |
50000 numbers |
2 |
Correct |
134 ms |
1620 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
277 ms |
2844 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
325 ms |
3240 KB |
115362 numbers |
2 |
Correct |
298 ms |
3396 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
441 ms |
4036 KB |
154271 numbers |
2 |
Correct |
494 ms |
5528 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
569 ms |
4572 KB |
200000 numbers |
2 |
Correct |
515 ms |
5456 KB |
199945 numbers |