can anyone tell me why my code is giving TLE. Thankyou in advance…
link to solution
problem link

I have changed my solution but getting WA this time…though i hv checked my program nearly for all testcases…can anyone tell me where my code is failing…Thankyou…solution link

We would suggest you to go through the editorial of QTREE6 here: and post your doubts in the comment section. This will help you get over your doubt fast.