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

            Problem A : Air Conditioning Machinery

            You are a technician for the Air Conditioning Machinery company (ACM). Unfortunately, when you arrive at a customer site to install some air conditioning ducts, you discover that you are running low on supplies. You have only six duct segments, and they are all of the same kind, called an “elbow.”

            You must install a duct in a confined space: a rectangular prism whose sides are multiples of a unit length. Think of the confined space as consisting of an array of unit cubes. Each elbow occupies exactly four unit cubes, as shown in Figure 1 below. A unit cube can be occupied by at most one elbow. Each elbow has exactly two openings, as indicated by the gray squares in the elbow shown in Figure 1. You may assemble the elbows into longer ducts, but your duct must be completely contained inside the given space. One way to connect two elbows is shown in Figure 2. Your task is to connect an inflow to an outflow. The inflow and the outflow are located on the exterior surface of the confined space, aligned with the unit cubes, as shown in Figure 3. To keep expenses down, you must accomplish this task while using the minimum number of elbows.
            Input
            The input consists of several test cases, each of which consists of a single line containing eleven input values separated by blanks. The input values for each test case are as follows.

            The first three input values are integers (xBmaxB, yBmaxB, and zBmaxB) that indicate the size of the confined space in the x, y, and z dimensions, respectively. Each unit cube in the confined space can be identified by coordinates (x, y, z) where 1 ≤ x ≤ xBmaxB, 1 ≤ y ≤ yBmaxB, and 1 ≤ z ≤ zBmaxB. xBmaxB, yBmaxB, and zBmaxB are all positive and not greater than 20.

            The next three input values are integers that indicate the location of the inflow by identifying the x, y, and z coordinates of the unit cube that connects to the inflow.

            The next input value is a two-character string that indicates the direction of the inward flow, using one of the following codes: +x, -x, +y, -y, +z, -z. The inflow connection is on the face of the unit cube that receives this inward flow. For example, if the data specifies an inflow direction of +y, the inflow connection is on the face of the unit cube that faces in the negative y direction. The next three input values are integers that indicate the location of the outflow by identifying the x, y, and z coordinates of the unit cube that connects to the outflow.

            The last input value is a two-character string that indicates the direction of the outward flow, using the same codes described above. The outflow connection is on the face of the unit cube that generates this outward flow. For example, if the data specifies an outflow direction of +y, the outflow connection is on the face of the unit cube that faces in the positive y direction.

            The last line of the input file consists of a single zero to indicate end of input.

            Output
            For each test case, print the case number (starting with 1) followed by the minimum number of elbows that are required to connect the inflow to the outflow without going outside the confined space. If the task cannot be accomplished with your supply of six elbow segments, print the word TImpossibleT instead. Use the format in the sample data.

            Sample Input
            5 4 3 3 1 1 +z 5 4 3 +x
            5 4 3 3 1 1 +z 1 2 3 -x
            0

            Output for the Sample Input
            Case 1: 2
            Case 2: Impossible 

                題意很簡(jiǎn)單:用不超過(guò)6塊上述形狀的管道(暫且稱(chēng)為管道吧),問(wèn)最少需要幾塊能將出口和入口連通。如果不能,輸出"Impossible"。這題類(lèi)似于三維的迷宮問(wèn)題,對(duì)于每個(gè)狀態(tài),可以有8種不同的操作,每增加一個(gè)操作,對(duì)應(yīng)于多用了一塊管道。有所不同的是:每個(gè)狀態(tài)除了它的坐標(biāo)(x,y,z)外,還多了一個(gè)方向向量V∈{+x,+y,+z,-x,-y,-z}。將這個(gè)因素也考慮到狀態(tài)判重里,然后用dfs或者bfs都可解決。還有一個(gè)需要注意的是,在進(jìn)行第一步操作的時(shí)候,要根據(jù)入口的方向V,對(duì)3個(gè)坐標(biāo)x,y,z其中的一個(gè)進(jìn)行+1或者-1操作,由向量V決定。至于為什么,仔細(xì)觀察下圖就明白了。

            posted on 2009-04-23 18:14 極限定律 閱讀(959) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): ACM-ICPC World Final 2008題解

            <2009年4月>
            2930311234
            567891011
            12131415161718
            19202122232425
            262728293012
            3456789

            導(dǎo)航

            統(tǒng)計(jì)

            常用鏈接

            留言簿(10)

            隨筆分類(lèi)

            隨筆檔案

            友情鏈接

            搜索

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            国产精品久久久久9999| 久久亚洲中文字幕精品一区| 亚洲综合伊人久久综合| 久久国产免费观看精品3| 国产成人久久精品激情| 91麻豆精品国产91久久久久久| 久久有码中文字幕| 97久久超碰成人精品网站| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 97精品依人久久久大香线蕉97| 久久国产色AV免费观看| 亚洲国产香蕉人人爽成AV片久久| 久久精品国产亚洲AV大全| 精品久久久久久无码中文野结衣| 久久成人国产精品免费软件| 99久久国产综合精品五月天喷水| 香蕉久久久久久狠狠色| 88久久精品无码一区二区毛片 | 亚洲国产精品婷婷久久| 国色天香久久久久久久小说 | 久久综合狠狠综合久久97色| 国产精品天天影视久久综合网| 国产成人综合久久精品红| 久久久WWW成人免费精品| 久久精品国产亚洲一区二区| 热re99久久精品国99热| 中文字幕精品无码久久久久久3D日动漫 | 无遮挡粉嫩小泬久久久久久久| 国产精品久久久久一区二区三区| 久久亚洲精品成人av无码网站| 中文成人久久久久影院免费观看| 国产精品久久久99| 狠狠人妻久久久久久综合| 久久国产精品国产自线拍免费| 99久久成人国产精品免费| 精品国产一区二区三区久久久狼| 人妻丰满AV无码久久不卡| 久久人人爽人人爽人人AV| 色综合久久久久久久久五月| 日本强好片久久久久久AAA | 亚洲精品成人久久久|