Can anyone point out some corner cases for which the solution is wrong. here is my solution—https://www.codechef.com/viewsolution/35583056

P.S. I have already spent lot of time debugging and my code seems to work like one in editorial.

I had the same error.

Consider this condition

5 5

1 2 3 4 6

Ans = 5

But your code gives 6.

1 Like

Actually you are missing these kind of test cases!

1

2 10

9 27

Ans: 3

Hope, It helps… It took hell out of time to figure this small tc.

1 Like

After sorting, start from the element A[i] such that A[i] ≥ 2*x. All the elements before A[i] will cured in a day. https://www.codechef.com/viewsolution/35329151