#15569. [ICPC 2022 Xi'an R] Cells Coloring
[ICPC 2022 Xi'an R] Cells Coloring
[ICPC 2022 Xi'an R] Cells Coloring
题目描述
You are given an $n \times m$ grid. Some of the cells are obstacles, the others are empty. Choose a non-negative integer $k$ and color all empty cells with $k+1$ colors $0, 1, 2, \ldots k$. 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 $n$, $m$ ($1\leq n, m\leq 250$), $c$ and $d$ ($0\leq c, d\leq 10 ^ 9$).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. 标签: P9359|2022|三分|网络流|O2优化|二分图|ICPC|西安