Codeforces and Polygon may be unavailable from December 6, 19:00 (UTC) to December 6, 21:00 (UTC) due to technical maintenance. ×

Hepic_Antony_Skarlatos's blog

By Hepic_Antony_Skarlatos, 10 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)

Thanks!!!