编程介的小学生 2017-07-14 06:53 采纳率: 20.5%
浏览 730
已采纳

Cavern

Description

A large system of caverns was discovered some time ago. PSOS know about it and they promised to make these caverns accessible for tourists. PSOS think it could add some more votes for the Party.

Unfortunatelly, there is a big problem. The members did not notice that the caverns are completely flooded by water. Because PSOS want to be modest and they do not want to break their promises, they started to think about the solution in case they really would win the election. One of the most interesting proposals involved even little submarines. But it seems as the best solution, to exhaust the water out of the cavern. The caverns are very well examined, that means it is exactly known where the water is. PSOS would like to know how much water they have to pump out, so they need a computer program that will be able to determine this.

All the cavern space consists of equal cubes, their size is 1 meter. Obviously, it is possible to exhaust water from a continous space only, e.g. the space consisting of neighbouring cubes. Moreover, only the space running to the top layer of cubes may be exhausted. Two cubes are considered neighbouring if they have one common side, not only the edge.
Input

At the first line there is a positive integer N stating the number of assignments to follow. Each assignment begins with three integer numbers X, Y, Z on a single line, separated by spaces. 1 <= X,Y,Z <= 100. All the flooded cubes are inside a box with the size X, Y, and Z meters. All cubes outside this box are filled with rock. After the first line, the description of Z layers follows, starting from the top one. Each layer begins with a line with a single integer number P that denotes the number of flooded cubes in that layer. Then P lines follow, each of them consisting of two integer numbers R and S, 1 <= R <= X, 1 <= S <= Y. These number are coordinates of one flooded cube, given in meters.
Output

Output a single line for each assignment. The line must contain the sentence "Je nutne vycerpat X litru vody." (X litres of water must be exhausted). Fill the right ammount of litres of water, instead of X. It should include all the water that is accessible from the top layer of the cavern.
Sample Input

2
4 4 5
1
3 3
2
1 2
3 3
4
1 2
2 2
2 3
3 3
2
3 3
1 1
0
3 7 2
1
2 4
5
1 4
2 3
2 4
2 5
3 4
Sample Output

Je nutne vycerpat 8000 litru vody.
Je nutne vycerpat 6000 litru vody.

  • 写回答

1条回答 默认 最新

  • devmiao 2017-07-29 13:55
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值