We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Ema's Supercomputer
Ema's Supercomputer
Sort by
recency
|
303 Discussions
|
Please Login in order to post a comment
I started out thinking I could simply go through each good cell and compute the biggest plus I could make with that cell as its center. While doing this, I tracked the largest two areas seen, then finally returned the product of those two values.
This doesn't work for two reasons:
The second case might happen if you have a 9-area plus and a 13-area plus that overlap. But inside the 13-area plus is a smaller 9-area plus that doesn't overlap with the other 9-area plus. Those two pluses might turn out to be the two largest ones in the grid.
So the approach looks more like this:
pluses
array to hold all of the pluses you find.pluses
.len(set1 & set2) > 0
.) If they don't overlap, update the maximum product found so far.Can anyone help me understand how the following test case is supposed to have an answer of 81? I see at least two crosses where you can cross 7 x 7 'G's for an area of 13 each. 13 * 13 = 169, not 81. Am I misunderstanding the principle of the problem? Am I missing something obvious?
Decided to get the coordinates of all possible crosses, then get the area for each combination of 2 that don't have overlapping coordinates, and finally return the maximum of those areas.
Got stuck for a while until I remembered I was storing a container within another container so changing the position also cleared it in the list. Worked perfectly after importing 'copy.deepcopy()'.
Python 3
Ruby
good problem, only took me 4 hours trying to define the collision equation before i shoot myself.