Can anyone tell why tle comes ?
Beautiful vertices
Check this if it passes. It is somewhat similar to your approach.
This is fine but can u tell why tle?
I used this way of traversing in previous ques like religious place as well but it gave tle.
also the test case you by mistake sent of
5 4
1 2
1 3
3 4
3 5
was passing i.e it was showing correct ans 0
Yes for that case it is passing. The test cases for this problem are very large…and your code is failing in that.
I will check your code and get back to you.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
You still didnt tell the mistake in my code
Check now. Declaring the maps globally and not passing for every function call by value will reduce the overhead and not give TLE.
But your code is giving wrong answer.Please recheck your logic considering different cases.