#P9359. [ICPC 2022 Xi'an R] Cells Coloring
[ICPC 2022 Xi'an R] Cells Coloring
Description
You are given an grid. Some of the cells are obstacles, the others are empty. Choose a non-negative integer and color all empty cells with colors . You can not color two cells in the same row or same column with the same non-zero color.
You are given two non-negative integers and . For a coloring plan, define as the number of the cells with color . Define the cost of the plan is .
Find the minimum cost.
Input Format
The first line contains four integers , (), and ().
The -th line of the next lines contains a string of characters. The -th character is * if the cell in the -th row and the -th column is an obstacle. The -th character is . if the cell in the -th row and the -th column is empty.
Output Format
Output a line with a single number, representing the answer.
3 4 2 1
.***
*..*
**..
4
3 4 1 2
.***
*..*
**..
2
Hint
Source: The 2022 ICPC Asia Xi'an Regional Contest Problem B.
Author: csy2005.
京公网安备 11011102002149号