rt,应为:
Note
Explanation of the first query:
After making first x=3 and last y=1 elements impossible to remove, a becomes [×,×,×,9,5,4,6,5,7,8,3,11,×] (we represent 14 as × for clarity).
Here is a strategy that removes 5 elements (the element removed is colored in red):
- [×,×,×,9,5,4,6,5,7,8,3,11,×]
- [×,×,×,9,4,6,5,7,8,3,11,×]
- [×,×,×,9,4,6,5,7,8,3,×]
- [×,×,×,9,4,5,7,8,3,×]
- [×,×,×,9,4,5,7,3,×]
- [×,×,×,9,4,5,3,×] (final state)
It is impossible to remove more than 5 elements, hence the weight is 5.