• <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>

            oyjpArt ACM/ICPC算法程序設計空間

            // I am new in programming, welcome to my blog
            I am oyjpart(alpc12, 四城)
            posts - 224, comments - 694, trackbacks - 0, articles - 6

            SRM406 PTS500 FoldThePaper

            Posted on 2008-06-18 11:29 oyjpart 閱讀(1560) 評論(0)  編輯 收藏 引用 所屬分類: ACM/ICPC或其他比賽程序設計

            Problem Statement

                 You have a rectangular piece of paper that's divided into 1x1 cells, each of which has an integer value. The paper will be described by a vector <string> paper. The ith element of paper will be a space delimited list of integers, where the jth integer of the ith element of paper represents the value of the jth cell of the ith row of the paper.



            You want to perform a sequence of folds on the paper, where you may fold anywhere along an axis that is in between two rows or columns of the paper. After performing a fold, we wish to model the folded paper as a new, flat piece of paper. We will do this by considering two overlapping cells as a single cell, with a value that is the sum of the individual cells.



            You wish to perform a sequence of folds such that the value of some single cell in the resulting piece of paper is as large as possible. Return this value.

            Definition

                
            Class: FoldThePaper
            Method: getValue
            Parameters: vector <string>
            Returns: int
            Method signature: int getValue(vector <string> paper)
            (be sure your method is public)
                

            Constraints

            - paper will contain between 1 and 12 elements, inclusive.
            - Each element of paper will be a single-space delimited list of integers with no leading or trailing spaces.
            - Each element of paper will contain between 1 and 12 integers, inclusive.
            - Each element of paper will contain the same number of integers.
            - Each element of paper will contain between 1 and 50 characters, inclusive.
            - Each integer in paper will be between -100 and 100, inclusive.
            - Each integer in paper will have no leading zeros.
            - An integer in paper equal to zero will not have a preceding negative sign.

            Examples

            0)
                
            {
            "1 1 1",
            "1 1 1"
            }
            Returns: 6
            We can collapse every cell onto the upper-left cell.
            1)
                
            {
            "1 -1",
            "1 -1"
            }
            Returns: 2
            We should perform only the fold between the two rows, and take the resulting left column.
            2)
                
            {
            "1 -1 -1 1",
            "-1 -1 -1 -1",
            "-1 -1 -1 -1",
            "1 -1 -1 1"
            }
            Returns: 4
            Folding between the middle rows then the middle columns allows us to combine the four corner cells.
            3)
                
            {
            "20 13 -2 100",
            "-12 0 4 -3",
            "4 1 -36 21"
            }
            Returns: 131

            4)
                
            {
            "0"
            }
            Returns: 0

            This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.


            題目大意是有一個12*12的矩陣,現在可以對這個矩陣橫向或縱向折疊,出在重疊位置的數相加。
            求折疊過程中任意位置產生的最大數。

            很多大牛fail了,我一個DFS+剪枝也超時了,一共32人pass sys test,1000pts無人ac,此套題難度還是很大的。

            基本思路是狀態壓縮DP,橫向(1<<12)*縱向(1<<12)*加和。

            但是這樣會超時。關鍵是沒有利用到折疊的信息。

            預先生成某個位置的狀態(由那些位置疊加而來),就可以減少檢查量,就可以ac了。

            如何生成這些狀態呢?沒錯,又是一個DP. 呵呵。


            久久精品99久久香蕉国产色戒 | 国色天香久久久久久久小说| 久久精品国产亚洲7777| 久久综合久久鬼色| 亚洲AV乱码久久精品蜜桃| 99国产欧美精品久久久蜜芽| 久久精品无码一区二区三区免费| 久久久久久久久66精品片| 久久国产高潮流白浆免费观看| 欧美777精品久久久久网| 久久久久国产日韩精品网站| 午夜精品久久久久久毛片| 国内精品久久久久久久涩爱| 伊人久久大香线蕉AV色婷婷色| 亚洲午夜久久久精品影院| 久久精品综合网| 久久99精品国产99久久6| 久久棈精品久久久久久噜噜| 欧美粉嫩小泬久久久久久久 | …久久精品99久久香蕉国产| 亚洲国产成人久久综合区| 久久久久久a亚洲欧洲aⅴ | 久久精品亚洲精品国产欧美| 天天爽天天狠久久久综合麻豆| 欧美久久一级内射wwwwww.| 久久99精品国产一区二区三区| 久久久久久国产精品无码下载| 久久国产成人午夜aⅴ影院| 久久国产成人精品麻豆| 国产精品一久久香蕉国产线看观看 | 久久婷婷人人澡人人爽人人爱| 久久伊人五月天论坛| 嫩草影院久久99| 国产69精品久久久久99| 成人午夜精品久久久久久久小说| 日本一区精品久久久久影院| 爱做久久久久久| 天天做夜夜做久久做狠狠| 日韩久久久久中文字幕人妻| 久久精品国产只有精品66| 久久亚洲色一区二区三区|