Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Cavern
Time Limit: 2000MSMemory Limit: 65536K
Total Submissions: 290Accepted: 113

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.

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator