Here's my approach. It may not be the most elegant, but it passed the test cases. First, handle 1*c, r*1, and only 1 free space separately. Then, recognize that you can always always push the free space to one corner. Suppose that the free spaces are in the top left, then row 1&2 must have the same number of free space, and same for column 1&2. Suppose row 1 has x free space and column 1 has y free space, then you can put in anywhere from 2*(x+y-2) to x*y free space safely. From here, I just brute force x and y.
-- You received this message because you are subscribed to the Google Groups "Google Code Jam" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/google-code/7ddcf362-a29b-47c0-b654-4dd393d920c0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
