Hey Guys

I need your help in solving http://www.codechef.com/problems/ARRAYTRM/

I’m not able to arrive at a straight logic to solve this problem.

I could only infer the following:

The difference of difference b/w the elements of chosen set and left-out elements could differ by k+1 after each operation.

I don’t know how to approach this problem. Would really appreciate any help, specially how to attacked the problem and used the intermediate inferences to reach to the logic.

thanks in advance.