Submit | All submissions | Best solutions | Back to list |
MAX2214 - Max 2214 |
Max2214 is a game that consists of a board of R rows and C columns and two kinds of blocks: Some of the blocks are 2 cells high and 2 cells wide, the others are 1 cell high and 4 cells wide. Some of the cells of the board might be marked. The objective of the game is to place the most blocks on top of the board in a way that the blocks are aligned to the rows and columns, no pair of blocks overlap, marked cells do not contain any block, and the 1x4 blocks are placed horizontally exclusively. Also, blocks must be completely inside the board.
Input
The input consists in a single test case with a 15 seconds execution limit.
The test case begins with 2 integers R and C in a single line: (1 <= R <= 52) (1 <= C <= 22).
The next R lines contain C characters. Each character represents a cell. If a character is X, it means the cell is a marked cell. If the character is '.' (A dot character) it means the cell is not marked.
Output
Show a single line containing the maximum quantity of blocks that can be placed in the board following the rules mentioned above.
Example
Input: 4 5
X....
X..XX
X..XX
....X Output: 3
Added by: | Vexorian |
Date: | 2012-07-01 |
Time limit: | 1.976s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | First international programming camp - Bolivia |
hide comments
2016-03-13 15:48:49 Scape
Amazing problem, thanks a lot for setting this one :) |
|
2012-08-04 02:26:32 Vexorian
Statistically yes. In practice, I think it is because the intended idea is not a common thing to think about. Most people are solving through other methods. If looking for spoilers, check out the topcoder problem "BrickPuzzle", which uses the same idea but in more complicated ways. |
|
2012-07-19 19:37:57 (Tjandra Satria Gunawan)(曾毅昆)
Very hard problem... uhh ~_~" |