2405:Avoid The Lakes(翻译)

http://noi.openjudge.cn/ch0308/2405/

描述

Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amount depending on the size of the largest "lake" on his farm.

农民John的农场在最近的暴雨中被淹了,这个事实因为他家怕水的奶牛而变得更加严重。他的保险公司会赔偿他,然而,是根据他农场最大的湖来赔偿的

The farm is represented as a rectangular grid with N (1 <= N <= 100) rows and M (1 <= M <= 100) columns. Each cell in the grid is either dry or submerged, and exactly K (1 <= K <= N*M) of the cells are submerged. As one would expect, a lake has a central cell to which other cells connect by sharing a long edge (not a corner). Any cell that shares a long edge with the central cell or shares a long edge with any connected cell becomes a connected cell and is part of the lake.

农场表示为一个n行m列的矩形,每一个格子要么是干燥的要么是被淹的并且有k个单元格被淹了。

正如人们所料,湖泊有一个中心单元,其他单元通过共享一条长边(而不是一个角)与之相连。任何与中央单元共享长边或与任何连接单元共享长边的单元都将成为连接单元,并且是湖泊的一部分。

输入

* Line 1: Three space-separated integers: N, M, and K

第一行:三个空格分开的整数n,m,k

* Lines 2..K+1: Line i+1 describes one submerged location with two space separated integers that are its row and column: R and C

第二行到k+1行:第i+1行描述了一个被淹的格子,其中有两个空格分隔的整数,分别是其行和列:R和C

输出

* Line 1: The number of cells that the largest lake contains.

一行:最大湖包含的单元格的数量

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值