Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

stupidaftowin's blog

By stupidaftowin, history, 6 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

»
6 years ago, hide # |
 
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)

  • »
    »
    6 years ago, hide # ^ |
     
    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.