When submitting a solution in C++, please select either C++14 (GCC 6-32) or C++17 (GCC 7-32) as your compiler. ×

-VIBE's blog

By -VIBE, history, 10 months ago, In English

The problem is not monster itself but problem name is....Can anyone tell me why i am getting tle...i am not able to figure out the time complexity of my solution.207893184

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

»
10 months ago, # |
Rev. 4   Vote: I like it +1 Vote: I do not like it

Edit : I generate this test case in which your dfs will run in $$$O(n*m)$$$, the issue is your dfs update the value of each node too many time

1
2001 2000
2 1 0 2 1 0 ....
1 2
2 3
...
(simple path)