We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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.
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?
Can anyone explain what the
deep_sum
array does in the problem setter's codeEditorial solution gives 60% of score :P
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.
How to prove that D(k,n) = 1/(k+2) using two formulas given in the editorial?
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