Help needed to solve SPOJ question ADACYCLE. (Getting TLE)

Правка en2, от ameyanator, 2018-02-14 09:45:46

I've been trying to solve this question, but I keep on getting a TLE. At first I had an O(V*(E+V)) approach (link). Then I optimized my code so that I store the results of other nodes while calculating the answer of some node. (link). I'm still getting an TLE.

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

Теги spoj, #help, adacycle

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский ameyanator 2018-02-14 09:45:46 14
en1 Английский ameyanator 2018-02-14 09:43:44 494 Initial revision (published)