Help in hit the coconut question

question :


my code- https://www.codechef.com/viewsolution/28611787
one of testcase is time limit exceeding inspite of n*z time complexity.Can anyone please help me to optimize my code.

2 Likes