Light OJ - 1011- Marriage Ceremonies - Tutorial

As n<=16, the problem can be solved with bitmask DP with 2 states. State-1 is for the row(Boy). State-2 is now which column(Girl) is free with bitmasking. Go row by row.
For every row(Boy), check the all available columns(Girl) one by one and calculate the best result. When all the girls have been taken, then the process will be terminated.

Think before you code -_-
Happy Coding -_-

Comments

Trending Post

At Coder Educational DP-A | DP Series(Episode-1)

Magic In Grid

At Coder Educational DP-B | DP Series(Episode-2)