Editorial for DMOPC '14 Exam Time P6 - Math Homework
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Since the source was mentioned in the footer, you can Google HDU 5155 solution
for some initial ideas. However, the given solutions are all too slow — or . To speed it up, you can assume each row has at least one 1
( ways to do so) and either use the Inclusion-Exclusion Principle or dynamic programming with the binomial coefficient to compute the ways with rows and columns for .
Time complexity: or
Comments