logo AlgoBeat OnlineJudge
登录 注册

#208805. [ICPC 2022 Xi'an R] Cells Coloring

内存限制:512 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

样例

样例输入 1

3 4 2 1
.***
*..*
**..

样例输出 1

4

样例输入 2

3 4 1 2
.***
*..*
**..

样例输出 2

2

数据范围与提示

Source: The 2022 ICPC Asia Xi'an Regional Contest Problem B.

Author: csy2005.