CF723D Lakes in Berland

题目描述

**【问题描述】** ldxxx已经填完了所有的坑,现在他要给土地浇水来保证幼苗的茁壮成长。然而他刚要浇水,就迎来了瓢泼大雨,由于土地渗透性不一,所以有的土地上存在积水,连在一起的积水就形成了一个小湖泊(只有四周被陆地完全包围的才算湖泊,只要和边界有交点就不算湖泊),这时cs告诉ldxxx说如果能将湖泊的数量缩小到一个值k的话,他的庄稼长得应该最茂盛。但是由于ldxxx很笨,不知道该怎么填,所以ldxxx把浇水的任务给了cs,由于这次是义务劳动,所以cs很懒,想填最少的水使得湖泊数量为k你需要告诉他把湖泊数降到**不大于k**至少需要填多少块,并且把填好后的土地积水情况给他打印出来。 注意:只有四周被陆地完全包围的才算湖泊,只要和边界有交点就不算湖泊。 题面翻译来自accoders

输入格式

The first line of the input contains three integers $ n $ , $ m $ and $ k $ ( $ 1

输出格式

In the first line print the minimum number of cells which should be transformed from water to land. In the next $ n $ lines print $ m $ symbols — the map after the changes. The format must strictly follow the format of the map in the input data (there is no need to print the size of the map). If there are several answers, print any of them. It is guaranteed that the answer exists on the given data.

说明/提示

$1\le n,m\le50,0\le k\le50$