"Mysterious" low running speed in Java

Правка en2, от Tom--CCS, 2018-06-28 16:15:23

Recently in Educational Codeforces round 46 I wrote the following programme for 1000E - Нужно больше боссов in Java:

39737014

Now I am pretty sure that the program runs in O(n + m) time(it is a dfs plus an iteration over the edges). However, the program got rejected due to Time Limit Exceeded despite its optimal asymptotic efficiency. Would anyone point out which part of my programme is consuming lots of time? I am a newbie in programming and really appreciate any help!

Update: Thank you all for giving me advice! I have solved the problem.

Теги java, time

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Tom--CCS 2018-06-28 16:15:23 74
en1 Английский Tom--CCS 2018-06-28 15:51:29 519 Initial revision (published)