born_2_code_'s blog

By born_2_code_, history, 16 months ago, In English

my submission: 186754670. Problem link

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

| Write comment?
»
16 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Well, your dfs function copies g every time, resulting in TLE. What you can do is to pass it by reference or have it global. Same goes for dfs2 and also the map in dfs2.