Problem Link :
How to solve it using greedy algorithm??
I solved this using Dynamic progrmming / recursion +memo (knapsac type problem )
Solution link mine using DP:Submission #124038035 - Codeforces
This problem is in greedy section and many others solved it using greedy which I am not able to think…
There is no editorial for this …