I was trying to solve FIRESC using http://www.codechef.com/viewsolution/3708062. Have used dfs implemented using stack in python and sys.stdin.readlines(). Yet, it is slow. Can someone suggest me if there is a faster way ? as here N=10^5, and it becomes slow for that.
Do not use python to solve algorithmic problems )
When constraints are about 10^5, it is always slow and you can easily get TL =(