getting wa : lights

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

my code:

problem link:


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