Hepic_Antony_Skarlatos's blog

By Hepic_Antony_Skarlatos, 9 years ago, In English

Problem statement is here: http://community.topcoder.com/stat?c=problem_statement&pm=13686 Solution: http://pastebin.com/jmVQ6twd

I firstly solved it with "binomials" and it was accepted. Now I solved it with dp,and pass all tests except the 8th.(TLE) Could anyone see if my code has anything wrong that make it slower,or it is due of python?

(I saw in editorial,they use almost the same logic)