acmsguru |
---|
Finished |
N M Q splitInfo1 splitInfo2 ... splitInfoM query1 query2 ... queryQThe first line contains three integers N (1 ≤ N ≤ 100000), M (0 ≤ M < N), and Q (1 ≤ Q ≤ 1000, Q ≤ N), which represents the numbers of objects, horizontal lines, and queries respectively. Then M lines follow to describe horizontal lines. Each line is given in the following format: Y L V1 V2... VL Y (0 ≤ Y ≤ 109) denotes the vertical position of the horizontal line; the smaller value indicates the upper position (or the less similarity). L is the number of vertical lines (i.e. objects or subgroups of objects) connected by the line. Vi (for 1 ≤ i ≤ L) indicates each of the vertical lines. Each object is indicated by its identifier, a unique number from 1 to N. Each subgroup of objects is indicated by the identifier of an arbitrary object in the subgroup. Following the description of horizontal lines, there are Q lines each of which indicates a leaf index at which your program should report which object should be placed. The index is given by a number from 1 (leftmost) to N (rightmost).
sample input | sample output |
3 2 3 10 2 1 2 20 2 3 2 1 2 3 | 1 2 3 |
sample input | sample output |
5 2 5 10 3 1 2 4 20 3 2 3 5 1 2 3 4 5 | 1 2 3 5 4 |
sample input | sample output |
4 1 4 10 2 1 4 1 2 3 4 | 1 4 2 3 |
sample input | sample output |
4 3 4 30 2 1 4 20 2 2 4 10 2 3 4 1 2 3 4 | 1 4 2 3 |
sample input | sample output |
4 3 4 10 2 1 4 20 2 2 4 30 2 3 4 1 2 3 4 | 1 2 3 4 |
sample input | sample output |
4 3 4 10 2 1 2 15 2 1 4 20 2 2 3 1 2 3 4 | 1 4 2 3 |
sample input | sample output |
3 2 3 10 2 2 3 20 2 1 2 1 2 3 | 1 2 3 |
sample input | sample output |
1 0 1 1 | 1 |
Name |
---|