Topcoder SRM 489, D2, 500-point problem
James S. Plank
This file just contains hints. Please see
this file for more detailed lecture notes.
Think about this problem a bit. It has a few components:
So, basically, this is a two-phase enumeration -- enumerate all potential combinations
of seed packets, and then enumerate all potential numbers of rows in a rectangle.
- An enumeration. You'll need to enumerate all potential combinations of
seed packets. That is a power set enumeration. Do it with bit arithmetic.
- When you have a combination of packets, you have to decide whether they
can make a rectangle, and what the largest such rectangle is. You can do
that by running through each value of R from 1 until R*R is
greater than the number of seeds, and determining if you can make a rectangle
with R rows.