#include <iostream>
#include <cstdio>
#include <stack>
using namespace std;
using I = int;
using Lf = long double;
stack<pair<Lf, Lf>> bals;
Lf slv(Lf d, Lf r) {
return d * d / (r * 4);
}
I main(void) {
#ifdef ETHANKIM8683
freopen("balloons.in", "r", stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
I n;
cin >> n;
for (I i = 0; i < n; i++) {
Lf x, r;
cin >> x >> r;
while (!bals.empty()) {
const auto [bal_x, bal_r] = bals.top();
r = min(r, slv(bal_x - x, bal_r));
if (r < bal_r)
break;
bals.pop();
}
printf("%.3Lf\n", r);
if (r > 0)
bals.push({x, r});
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
10 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
316 KB |
2 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
505 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
340 KB |
2000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
664 KB |
20000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
55 ms |
1708 KB |
50000 numbers |
2 |
Correct |
43 ms |
1560 KB |
49912 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
2840 KB |
100000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
120 ms |
3276 KB |
115362 numbers |
2 |
Correct |
104 ms |
3432 KB |
119971 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
150 ms |
4176 KB |
154271 numbers |
2 |
Correct |
173 ms |
5388 KB |
200000 numbers |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
184 ms |
4596 KB |
200000 numbers |
2 |
Correct |
170 ms |
5448 KB |
199945 numbers |