TAJ from July LoC TLE

,

Can anyone tell me why my code is giving TLE. Here is the link to my solution https://www.codechef.com/viewsolution/19548230
Complexity O(Max(E+V,Q)).

Use printf instead of cout for printing the answer and you should be fine!

Got it! Thanks mate!