getting wa : lights

i have tried for many test cases my code gives correct answer but on submitting it gives WA

my code: http://www.codechef.com/viewsolution/3795774

problem link: http://www.codechef.com/problems/LIGHTS

THANKS IN ADVANCE

This is the accepted solution. You have to sort the β€œc” array so that you consider all the elements which are less than (n+1)/2. β€œsort()” is a predefined function in c++. You can read more about it from this link.

1 Like