Help needed to solve SPOJ question ADACYCLE. (Getting TLE)
Difference between en1 and en2, changed 14 character(s)
I've been trying to solve this [question](http://www.spoj.com/problems/ADACYCLE/), but I keep on getting a TLE. At first I had an O(V*(E+V)) approach ([link](http://p.ip.fi/QP1E)). Then I optimized my code so that I store the results of other nodes while calculating the answer of some node. ([link](http://p.ip.fi/cZlT)). I'm still getting an TLE.↵

Can anyone please suggest another optimization/approach for this question so that I can get an AC?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English ameyanator 2018-02-14 09:45:46 14
en1 English ameyanator 2018-02-14 09:43:44 494 Initial revision (published)