I was trying to solve 1529C - Parsa's Humongous Tree.
i used the below code which gave memory limit exceeded.
then i used fill() instead of clear() function which was also used in the tutorials. And i got my soln ac.
I used clear() in first code whereas fill() in the later one. WHAT IS THE DIFFERENCE BETWEEN THOSE TWO??
The graph is 1-indexed but you are not clearing adj[n]. That's why you get MLE.
If you change
for(int i = 0; i < n ; i ++)
tofor(int i = 1 ; i <= n ; i ++)
you'll get AC.modified code
Thanks a lot.