Magic Number Tree

Sort by

recency

|

5 Discussions

|

  • + 1 comment

    Can anyone explain what the deep_sum array does in the problem setter's code

  • + 0 comments

    Editorial solution gives 60% of score :P

  • + 0 comments

    I have a naive solution which finds all possible game paths, sums there magic numbers and divides by number of paths only passes two submission tests.

    I understand why it timeouts and maybe gets errors due to recursion depth, but why result could be incorrect?

    I use following code for result: res = (total_summ * math.factorial(n) // path_count) % (10**9+9)

    Python has arbitrary length integers, so this should work. I use integer division, first multiplying and then dividing, because problem states that Em * n! will always be integer.

  • + 1 comment

    How to prove that D(k,n) = 1/(k+2) using two formulas given in the editorial?

  • + 2 comments

    I thought that the probability that a path between two nodes which are separated by nodes would be included in was Then I computed the distance between every two nodes and multiplied them by their corresponding probabilities, including the factor of Why didn't this work?

    http://ideone.com/i7baRx

No more comments