Tom--CCS's blog

By Tom--CCS, history, 2 years ago, In English

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


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.

Read more »

  • Vote: I like it
  • +6
  • Vote: I do not like it