Youngkwail Club Room
Time limit1sMemory limit256 MB
Cover all '.' cells of a grid with 1x1 and 1x2 tiles, avoiding 'X' pillars, using the fewest tiles possible.
- Level
Hard9 of 10
- Topics
- Graph, DFS, Union-find, Combinatorics
- Solved
- No attempts yet
Problem
Youngkwail was about to lose its club room, but the skill of its outstanding members was recognized and the club room was reassigned. Now happy, Youngkwail's treasurer Jaehyun buys tiles and tiles and wants to cover the entire club room floor.
Given a floor plan of the club room, write a program that prints the minimum number of tiles needed to cover the entire floor, so Jaehyun can save money.
Input
The first line gives the number of rows and columns of the floor plan. (, )
Starting from the second line, lines each give a string of length describing the floor plan. In the -th line, the -th character is . for floor and X for a pillar.
Output
Print the minimum number of tiles needed on the first line.