I have tried submitting this problem and such similar problems form CSES graph section , but got TLE in every problem for 2 or 3 test cases , please provide a good optimization to my code and some suggestions also .
Here is my submission.
I have tried submitting this problem and such similar problems form CSES graph section , but got TLE in every problem for 2 or 3 test cases , please provide a good optimization to my code and some suggestions also .
Here is my submission.