Code is only passing one test case

Could u please answer my querry ???

Now it’s working https://ide.codingblocks.com/s/332422

what is memeset role and what does it do with the code that u used it here??

You had to reinitialise the array p to 0 for every t, otherwise it may contain values from previous t.
So memset reinitialises every element of p to 0.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.