#P9359. [ICPC 2022 Xi'an R] Cells Coloring
[ICPC 2022 Xi'an R] Cells Coloring
题目描述
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.
输入格式
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 a line with a single number, representing the answer.
3 4 2 1
.***
*..*
**..
4
3 4 1 2
.***
*..*
**..
2
提示
Source: The 2022 ICPC Asia Xi'an Regional Contest Problem B.
Author: csy2005.