stupidaftowin's blog

By stupidaftowin, history, 4 years ago, In English

How to solve 1437D - Minimal Height Tree if the question asked to count the number of valid trees?

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

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

This could have been solved using a dp state (i,curr_parent), if the constraints were a bit less. (n<=3000)

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

    That's actually pretty much good. I got it too. I was thinking if it's possible to solve with original constraints of the problem.