Help with TLE

Problem : https://www.codechef.com/problems/TREDIFF

Solution : https://www.codechef.com/viewsolution/34699404

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.
Submission.

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.