zakho's blog

By zakho, history, 4 years ago, In English

Here is the link to the problem 1057A Here is my submission 90081794

  • Vote: I like it
  • -2
  • Vote: I do not like it

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

This line

path = to_string(current->data) + " " + path;

makes your solution quadratic in complexity, because path gets copied, and its length is $$$O(N)$$$.

  • »
    »
    4 years ago, # ^ |
      Vote: I like it +8 Vote: I do not like it

    removing this part and replacing it with vector resolved the issue. Thanks @sempav