Kanata18's blog

By Kanata18, history, 2 months ago, In English

Hello Codeforces!!

I saw this problem days ago and I have tried to solve it since then but I have not been successful. Help me please

This is the problem

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

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Kanata18 (previous revision, new revision, compare).

»
2 months ago, # |
  Vote: I like it 0 Vote: I do not like it

simply maintain an ordered set of nodes in current path while doing dfs and use find_by_order

  • »
    »
    2 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    I already tried and got MLE

    • »
      »
      »
      2 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      You are probably passing something by value

      This ran in 170Mb/2s
      • »
        »
        »
        »
        2 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thank you very much, I already have an idea how to get AC