• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 87  文章 - 279  trackbacks - 0
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            潛心看書研究!

            常用鏈接

            留言簿(19)

            隨筆分類(81)

            文章分類(89)

            相冊

            ACM OJ

            My friends

            搜索

            •  

            積分與排名

            • 積分 - 216652
            • 排名 - 117

            最新評論

            閱讀排行榜

            評論排行榜

            Giftbox
            Time Limit:4000MS? Memory Limit:131072K
            Total Submit:1210 Accepted:218

            Description

            Bobobo and Bottle are good friends, and the birthday of Bottle is coming. So Bobobo is considering preparing Bottle an unexpected gift for his birthday. As a common sense that when a person at his or her birthday party, he or she will open the gift with the presence of the person who gives the gift and then expresses the appreciation. Bobobo knows that the characteristic of Bottle is rush when he receives something important, so he wants to play a joke on him in this way…

            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

            5 7
            4 6 8 2 7 5 3
            2 8 13 6 10 9 4
            80 70 12 3 6 8 2
            8 7 4 6 9 10 12
            100 200 300 400 500 600 700
            800 800 800 800 800 800 800

            Sample Output

            3

            Source
            POJ Monthly--2006.09.29, sza

            ?

            #include? < iostream >
            #include?
            < algorithm >
            using ? namespace ?std;

            const ? int ?MAXN? = ? 510 ;
            const ? int ?MAXM? = ? 1010 ;

            int ?n,?m;
            int ?data[MAXN][MAXM];
            int ?map[MAXN][MAXN];
            int ?i,?j,?k;
            int ?f[MAXN];
            int ?d[MAXN];
            int ?ans;

            int ?DP( int ?b)
            {
            ????
            if ?(d[b]? > ? 0 )? return ?d[b];
            ????
            int ?i;
            ????
            int ?t? = ? 0 ;
            ????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????
            {
            ????????
            if ?(f[i]? && ?b? != ?i? && ?map[b][i]? && ?t? < ?DP(i)? + ? 1 )?t? = ?DP(i)? + ? 1 ;
            ????}

            ????d[b]?
            = ?t;
            ????
            return ?d[b];
            }


            int ?main()
            {???
            ????
            while ?(scanf( " %d%d " ,? & n,? & m)? != ?EOF)
            ????
            {
            ????????
            for ?(i = 0 ;?i <= n;?i ++ )
            ????????
            {
            ????????????
            for ?(j = 0 ;?j < m;?j ++ )
            ????????????????scanf(
            " %d " ,? & data[i][j]);
            ????????????sort(data[i],?data[i]
            + m);
            ????????}

            ????????
            ????????memset(f,?
            1 ,? sizeof (f));
            ????????
            ????????
            for ?(i = 1 ;?i <= n;?i ++ )
            ????????????
            for ?(j = 0 ;?j < m;?j ++ )
            ????????????????
            if ?(data[i][j]? <= ?data[ 0 ][j])
            ????????????????
            {
            ????????????????????f[i]?
            = ? 0 ;
            ????????????????????
            break ;
            ????????????????}

            ????????????????
            ????????
            for ?(i = 0 ;?i <= n;?i ++ )
            ????????????
            for ?(j = 1 ;?j <= n;?j ++ )
            ????????????
            {
            ????????????????map[i][j]?
            = ? 1 ;
            ????????????????
            for ?(k = 0 ;?k < m;?k ++ )
            ????????????????
            {
            ????????????????????
            if ?(data[i][k]? >= ?data[j][k])
            ????????????????????
            {
            ????????????????????????map[i][j]?
            = ? 0 ;
            ????????????????????????
            break ;
            ????????????????????}

            ????????????????}

            ????????????}

            ????????????
            ????????memset(d,?
            0 ,? sizeof (d));

            ????????ans?
            = ?DP( 0 );

            ????????
            if ?(ans? == ? 0 )
            ????????????printf(
            " Please?look?for?another?gift?shop!\n " );
            ????????
            else
            ????????????printf(
            " %d\n " ,?ans);
            ???????????????????????
            ????}

            ????system(
            " pause " );
            ????
            return ? 0 ;
            }

            posted on 2006-09-30 01:46 閱讀(517) 評論(0)  編輯 收藏 引用 所屬分類: ACM題目
            欧美亚洲国产精品久久高清| 色8久久人人97超碰香蕉987| 亚洲国产精品无码久久| 精品久久久久一区二区三区| 99久久99久久久精品齐齐 | 国产免费久久精品99re丫y| 夜夜亚洲天天久久| 2022年国产精品久久久久| 国产情侣久久久久aⅴ免费| 久久国产精品成人片免费| 久久偷看各类wc女厕嘘嘘| 国产亚洲精品久久久久秋霞 | 一级做a爰片久久毛片毛片| 久久久久国产一区二区三区| 国产一区二区三精品久久久无广告 | 日韩精品久久久久久久电影蜜臀| 国产A三级久久精品| 久久免费看黄a级毛片| 中文国产成人精品久久不卡| 久久久久免费看成人影片| 久久久无码一区二区三区| 精品国产乱码久久久久久郑州公司 | 亚洲国产精品无码久久九九| 99久久无色码中文字幕人妻| 久久亚洲精品成人AV| 久久久中文字幕| 久久毛片免费看一区二区三区| 欧美日韩中文字幕久久久不卡| 久久久久波多野结衣高潮| 久久久久久久亚洲Av无码| 国产成人精品久久一区二区三区av | 国产精品欧美亚洲韩国日本久久| 亚洲成av人片不卡无码久久| 久久久久亚洲精品天堂| 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 久久最近最新中文字幕大全| 一级女性全黄久久生活片免费| 日韩久久久久久中文人妻| 久久精品无码一区二区app| 色偷偷久久一区二区三区| 久久久久国产一区二区|