Question link = NOMATCH Problem - CodeChef
my answer link = CodeChef: Practical coding for everyone
I don’t understand why your solution would work. In the question, you must have to subtract half the elements from other half. While you are just adding all of them.(and making all the negative elements positive.)
Here is my another answer for this problem. Check that out.