Given an array, you can pick up toexactly $x$ (where $x \leq 3$) elements in one operation and decrease each of them by 1 (all picked elements must be at least 1). You then add $x$ points to your score. You need to maximize your points with these operations applied any number of times as long as it is possible.↵
↵
I think you could use a priority queue to greedily pick the top $x$ largest elements and decrease them by 1, but the problem is that the elements can go up to $10^{16}$.↵
↵
Also, the length of the array is at most 200.
↵
I think you could use a priority queue to greedily pick the top $x$ largest elements and decrease them by 1, but the problem is that the elements can go up to $10^{16}$.↵
↵
Also, the length of the array is at most 200.