Aspergillus's blog

By Aspergillus, history, 3 hours ago, In English

Given an array, you can pick up to $$$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.

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
95 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

If you pick a element you add a point , if you pick two you add two points if you pick three elements you add 3 points.

But you decrease 1 , 2, respectively 3 vals by 3 , so if we consider the whole sum of the array you decrease the sum by 1 you increase ans by 1 so that wouldnt actually mean that the ans is the sum of the array?