Ya, that was a mistake.
But Still Getting WA after correcting it.
I have compared the test cases with solutions which Got AC but still couldn’t find my mistake. https://www.codechef.com/viewsolution/15416462
The mistake is obvious. The size of bb is just 600. It should atleast be as much as N, but then you will get TLE instead of WA in final subtask. There can be as many as N different values for del, so if you are storing only 600 of those, some values are getting lost.
I appreciate the comments in the code. Looking at your code, just commented to tell that I appreciate that you inserted comments for better understanding