Problem bugging me for a few hours

Revision en2, by Aspergillus, 2024-08-07 09:16:27

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

Tags help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Aspergillus 2024-08-07 09:16:27 11 Tiny change: ' can pick up to $x$ (wher' -> ' can pick exactly $x$ (wher'
en1 English Aspergillus 2024-08-07 00:00:55 562 Initial revision (published)