luogu#P9359. [ICPC2022 Xi'an R] Cells Coloring
[ICPC2022 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.