SPOJ JOHNNY

find the sum half it and then sort the array and accordingly store the positions and then find the sum of the sorted array which is nearest to half the sum of weights.

edit: the above method does not work. in the case 3 6 6 8, you must take 3,8 in left hand, not 3,6.