当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3329:The Flood

题目描述
Global warming has us all thinking of rising oceans — well, maybe only those of us who live near the ocean. The small island nation of Gonnasinka has employed you to answer some questions for them. In particular they want to know how high the water has to get before their island becomes two islands (or more).

Given a grid of integers giving the altitudes of the island, how high must the ocean rise before the land splits into pieces?
输入解释
Each test case begins with a line containing two positive integers n, m giving the dimensions of the igrid, then n lines each containing m positive integers. The integers indicate the original altitude of the grid elements. Grid elements are considered to be adjacent only if they share a horizontal or vertical edge. Values of zero (0) along the perimeter, and all zero cells connected to these, are ocean at its initial level. Cells of 0 not connected to the perimeter (that is, surrounded by higher land) are simply sea level elevations. Furthermore, assume the ocean initially surrounds the given grid. The island is initially connected. Neither n nor m will exceed 100 and heights will never exceed 1000. A line with 0 0 follows the last test case.
输出解释
For each test case output one of the two following lines.
Case n: Island splits when ocean rises f feet.
or
Case n: Island never splits.
Our convention here is if your answer is, say, 5 feet, you more accurately mean “5 feet plus a little more.” That is, at least a little water will be flowing over the originally 5 foot high portion of land.
输入样例
5 5
3 4 3 0 0
3 5 5 4 3
2 5 4 4 3
1 3 0 0 0
1 2 1 0 0
5 5
5 5 5 5 7
4 1 1 1 4
4 1 2 1 3
7 1 0 0 4
7 3 4 4 4
0 0
输出样例
Case 1: Island never splits.
Case 2: Island splits when ocean rises 3 feet.
来自杭电HDUOJ的附加信息
Recommend teddy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3329

最后修改于 2020-10-25T23:02:24+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)