the example given in the link , tried 2-3 other example ..it seems to work for them.Maybe problem is not that simple and may fail for some tricky test case.So please correct me if i am wrong:-
input : 2 3 4 1 1 sort(input) : 1 1 2 3 4 k=3 from end keep on adding till k-1 add position 4 become : 4+3+2 (cost 5 : 3 + 2) add position 2 : 1+1 (cost 1 :1) add position 2 to 4 : 4+3+2+1+1(cost 2 ) total cost : 5+1+2 = 8 On Tue, Sep 25, 2012 at 1:23 AM, Krishnan <aariyankrish...@gmail.com> wrote: > http://codeforces.com/contest/227/problem/D > > How to approach this problem can anybody help? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.