Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Summits
Description You recently started working for the largest map drawing company in the Netherlands. Part of your job is to determine what the summits in a particular landscape are. Unfortunately, it is not so easy to determine which points are summits and which are not, because we do not want to call a small hump a summit. For example look at the landscape given by the sample input. We call the points of height 3 summits, since there are no higher points. But although the points of height 2, which are to the left of the summit of height 3, are all higher than or equal to their immediate neighbours, we do not want to call them summits, because we can reach a higher point from them without going to low (the summits of height 3). In contrast, we do want to call the area of height 2 on the right a summit, since if we would want to walk to the summit of height 3, we first have to descend to a point with height 0. After the above example, we introduce the concept of a The problem is, given a rectangular grid of integer heights and an integer Input On the first line one positive number: the number of testcases, at most 100. After that per testcase: One line with three integers 1 ≤ *h*≤ 500, 1 ≤*w*≤ 500 and 1 ≤*d*≤1 000 000 000 .*h*and*w*are the dimensions of the map.*d*is as defined in the text.*h*lines with*w*integers, where the*x*th integer on the*y*th line denotes the height 0 ≤*h*≤1 000 000 000 of the point (*x*,*y*).
Output Per testcase: - One line with the number of summits.
Sample Input 1 6 10 2 0 0 0 0 0 0 0 0 0 0 0 1 2 1 1 1 1 0 1 0 0 2 1 2 1 3 1 0 0 0 0 1 2 1 3 3 1 1 0 0 0 2 1 2 1 1 1 0 2 0 0 0 0 0 0 0 0 0 0 0 Sample Output 4 Source |

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

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator