Help with this Solution of Mine (CK87MEDI)

This is the Problem link

Solution Link
https://www.codechef.com/viewsolution/27808881
What is Wrong with my solution and Thinking my solution Passes all given test cases.But it’s still WA.

Can you see a way of adding two elements to get a median greater than 11 for

1
3 2
11 12 13

?

2 Likes

See, the elements in the array can be upto 1000. You are adding just 9 to your vector and sorting it, this will disturb the median. Remember, the median will be one of the elements from the given array only. Instead of adding 9, just add 1001 to the vector.

1 Like