Help with TLE

Problem :

Solution :

First, you should clear adjacency lists between test cases

Also, you might get WA on top of that, because on line 67 you should include 100

1 Like

Mine gives TLE too. Sub-tasks passed, but TLE for the second task.

Use fast I/O (and get rid of endl)

1 Like

It Worked! Thanks!

thanks a lot, you are very helpful, great to have you support here. :muscle: AC.