I m getting “Wrong answer” for this submission http://www.codechef.com/viewsolution/2059067 . Can anyone please help to check and tell me the reason as to why this is not being accepted. As I check at my end, the output and input format are exactly the same as required.
~Thanks for your time
I did some modifications to you code and it got AC.
check it out code link
never print anything except the output. You don’t have to make your program user friendly. Strictly follow the Output format.
and i added the line
@aichemzee, Thanks a lot for your help.
I get your point regarding the output formats, but I don’t understand why we need this line here.
Can you explain a bit.
@aichemzee, Thanks bhai…
we need this line because if k gets larger than n/2 the other group (having n-k elements) will have lesser number of items. So to increase the difference you will have to choose n-k smaller elements in this group and the larger k elements in the other.