Holiday Accomodation SPOJ

I have tried the problem on spoj.
There the online judge is showing TLE.
PLease help me to optimise the code.

The link to problem (SPOJ) : - https://www.spoj.com/problems/HOLI/

The link to my solution :- https://ide.codingblocks.com/s/228964

Hey @krikhi
Use FAST IO
And loose the visited map
Use a boolean array with size equal to max possible number of vertices

Thanks a lot for the help

1 Like