This greedy should not pass the judge, as it does not work for the following input:kp wrote:I solved it using both DP and greedy.
Greedy is as follows:
1. Take one guy with maximum value
2. Take two appropriate guys with minimum sum of values
However, I have not proved it.
Code: Select all
9
8 8 7 7 7 7 6 6 4
0