d******0 发帖数: 191 | 1 Draw as few as possible rectangle to cover all 1. Each rectangle can not
contain 2.
{".........."
,".........."
,".........."
,".1.1.1...."
,".........."
,".1.1.1...."
,".......2.."
,".1.1.1...."
,"........1."
,".........."}
Returns: 2
A selection rectangle can be drawn around the block of 9 1s, and then
another one around only the isolated 1:
..........
..........
|-----|...
|1.1.1|...
|.....|...
|1.1.1|...
|.....|2..
|1.1.1||-|
|-----||1|
.......|-|
1)
{".........."
,".........."
,".........."
,"..111....."
,"..121....."
,"..111....."
,".........."
,".........."
,".........."
,".........."}
Returns: 4
2)
{".........."
,".1....1..."
,"..2......."
,"...1.1...."
,"....2....1"
,".....1..2."
,"..1......."
,".......1.."
,".2........"
,"....111..."}
Returns: 4
我的想法是 把每一个“1”点 digest出来 而后dp 最少的rectangle。不知怎么record
.想乱了。。。 | d******0 发帖数: 191 | |
|