求指教,麻烦各位看看这道竞赛题.
In this problem you will be given a number of scenarios. Each scenario begins with a line containing two digits X and Y (separated by a space) representing the length and width of the grid (0 < X, Y <= 30). A scenario in which X and Y are both 0 marks the end of input.The second line of the scenario is a single digit M (0 < M <= 1000) which gives the number of items located by the archaeologists. This is followed by M lines each containing the X and Y coordinates of the grid cell in which an item was found. Note that the grid coordinate system starts at 0, 0 and that several items may be found in a particular cell, so cell coordinates may be repeated.
Following the M lines of item locations there is a list of cell references for which the total number of found items is required. The first line of this section is a single integer, N, which gives the number of cells (0 < N <= (X * Y)). There follows N lines each containing the X and Y coordinates of a cell.
Output consists of a single line for each scenario. It contains the total number of items found in the N cells listed.
For example:
Input Output
2 3 2
4 3
0 1
1 0
0 1
1 2
1
0 1
10 10
8
4 5
3 4
0 0
1 5
9 9
5 6
3 4
9 9
3
9 9
4 5
6 3
0 0
这是老师今天留给我们的题目,我英文水平有限,题和这道题的关系都有点看不明白,请教与网络,请大家帮帮忙。