当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

2 3 2 3 1 1 5 4 4 1 2 3 4 1 1 2 3
6 30
For the first test case, ans[1,2,3]={1,1,1}.
For the second test case, ans[1,2,3,4]={1,2,3,4}.
For example, if you have 4 units of initial energy, you can kill the 4th, 3rd, 2nd and then 1st monster in order.
First you kill 4th monster, your energy will be 4-4+3=3.
Next, you attack 3rd monster, your energy will be 3-3+2=2.
After killing them, you kill 2nd one, then energy will become 2-2+1=1.
Finally, you can kill 1st one since your energy is not less than A_1.
| Recommend | liuyiding |
| 时间上限 | 内存上限 |
| 6000/3000MS(Java/Others) | 524288/524288K(Java/Others) |