![]() | ||||
Online Judge | Problem Set | Authors | Online Contests | User |
---|---|---|---|---|
Web Board Home Page F.A.Qs Announcement | Current Contest Past Contests Scheduled Contests Award Contest |
Giftbox
Description Bobobo
comes into a gift shop, and there are a lot of different kinds of gift
boxes. Bobobo intends to choose various boxes with different size and
choose one of the gift boxes to contain the precious gift and place
this box into another bigger box and place this bigger box into another
bigger one¡ So Bottle will not see the gift until he opens the
innermost box. Imagine the process of his opening the boxes, how rush
Bottle will be ^_^ ! The gift boxes are n-dimensional. An n-dimensional box with dimensions ( X1, X2, ¡, Xn ) can be put into another box with dimensions ( Y1, Y2, ¡, Yn ) if there exists a permutation ¦Ð on { 1, 2, ¡, n } such that X¦Ð1 < Y1, X¦Ð2 < Y2, ¡, X¦Ðn < Yn. The gift is also n-dimensional
and it can be put into a box if it satisfies the criterion above. And
Bobobo must try his best to choose as many as boxes to contain the gift. Input The
input file contains multiple test cases. The first line of each test
case contains two numbers. The first one is a positive integer number N (1 ¡Ü N ¡Ü 500), the number of boxes in the gift shop, and the second one is a positive number d (3 ¡Ü d ¡Ü 1 000), the dimension of all the boxes. The next one line contains d positive integers ( G1, G2, ¡, Gd ) representing the dimensions of the gift. And the subsequent N lines each contain d positive integers ( X1, X2, ¡, Xd
) representing the dimensions of each box. You may assume that all the
numbers you encounter are positive integers and less than 231. The input data is terminated by EOF. Output The
output of each test case will contain only one line. Output the maximum
number of the boxes that Bobobo can choose. If Bobobo can not find any
box which can contain the gift, output ¡°Please look for another gift
shop!¡± Sample Input Sample Output Source |
[Submit] [Go Back] [Status] [Discuss]
All Copyright Reserved 2003-2005 Ying Fuchen,Xu Pengcheng
Any problem, Please Contact Administrator