• <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>
            posts - 74,  comments - 33,  trackbacks - 0
            Wedding
            Time Limit: 1000MS Memory Limit: 65536K
            Total Submissions: 821 Accepted: 249 Special Judge

            Description

            Up to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, opposite each other, and the bride wears an elaborate headdress that keeps her from seeing people on the same side as her. It is considered bad luck to have a husband and wife seated on the same side of the table. Additionally, there are several pairs of people conducting adulterous relationships (both different-sex and same-sex relationships are possible), and it is bad luck for the bride to see both members of such a pair. Your job is to arrange people at the table so as to avoid any bad luck.

            Input

            The input consists of a number of test cases, followed by a line containing 0 0. Each test case gives n, the number of couples, followed by the number of adulterous pairs, followed by the pairs, in the form "4h 2w" (husband from couple 4, wife from couple 2), or "10w 4w", or "3h 1h". Couples are numbered from 0 to n - 1 with the bride and groom being 0w and 0h.

            Output

            For each case, output a single line containing a list of the people that should be seated on the same side as the bride. If there are several solutions, any one will do. If there is no solution, output a line containing "bad luck".

            Sample Input

            10 6
            3h 7h
            5w 3w
            7h 6w
            8w 3w
            7h 3w
            2w 5h
            0 0
            

            Sample Output

            1h 2h 3w 4h 5h 6h 7h 8h 9h
            

            Source

            Waterloo Local Contest, 2007.9.29
            。。。。。。。。。。。。。。。。。。。。
            郁悶。。。。。。。。。。。。。。。。。。
            搞的一下午。。。。。。。。。。。。。。。錯(cuò)了N次。。。。
            題目很WS最后從讀一遍。。。。。。。。。終于讀懂。。。。。
            餓死我了。。。。。。。。。。。。。。還不會(huì)構(gòu)圖。。。。。。
            先吃飯,回來(lái)在搞。。。。。。。,今天就這5道題還困難了。。。郁悶。
            --------------------------------------------------------------------------------------------------------------------------------------------------------------
            2009.6.8? 22:34??
            代碼很丑不貼了,再有6分鐘就熄燈了。。。。。躺下想了一會(huì)感覺(jué)一起思路是對(duì)的就是沒(méi)有考慮0w-》0h的這條邊。。。。
            結(jié)果一改之。。。。。。。。。。AC??
            5281113xujiaming3648Accepted364K0MSC++2635B2009-06-08 22:33:58????

            2009-06-08 22:33:58 AC時(shí)間? AC完了之后說(shuō)了兩個(gè)字“我日”耗費(fèi)了兩秒鐘。然后直接打開(kāi)Blog。今晚終于搞出來(lái)了
            感謝指出Bug的大牛。
            啊,自習(xí)了、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、
            posted on 2009-06-07 17:19 KNIGHT 閱讀(1447) 評(píng)論(3)  編輯 收藏 引用

            FeedBack:
            # re: poj 3648 Wedding
            2009-06-07 22:29 | Knignt
            6道2-SAT獨(dú)此道沒(méi)刷。。。。。。郁悶
            待到花明時(shí),再議  回復(fù)  更多評(píng)論
              
            # re: poj 3648 Wedding
            2009-08-25 20:53 | inowfordream
            借問(wèn)一下大牛,為什么0w-》0h的這條邊一定要選?  回復(fù)  更多評(píng)論
              
            # re: poj 3648 Wedding[未登錄](méi)
            2009-08-25 21:37 | Knight
            @inowfordream
            有個(gè)條件說(shuō)夫妻不能在一邊吧 。。。。這題很久了。。  回復(fù)  更多評(píng)論
              

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問(wèn)   Chat2DB   管理


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

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            狠狠色丁香婷婷综合久久来| 久久婷婷激情综合色综合俺也去| 久久综合久久综合九色| 国产精品美女久久久久| 久久久久夜夜夜精品国产| 久久久久成人精品无码| 国产色综合久久无码有码| 久久99国产综合精品| 久久精品国产精品亚洲| 伊人久久大香线蕉av一区| 香蕉久久夜色精品国产小说| 无码国内精品久久人妻麻豆按摩| 久久综合亚洲鲁鲁五月天| 国产99久久精品一区二区| 亚洲国产精品综合久久网络| 久久AV高清无码| 久久久综合香蕉尹人综合网| 久久AV高清无码| 亚洲精品高清一二区久久| 四虎国产永久免费久久| 97精品伊人久久久大香线蕉| 久久亚洲国产精品123区| 精品久久久久久亚洲| 麻豆成人久久精品二区三区免费 | 久久99精品久久久久久hb无码| 欧美一级久久久久久久大| 久久久久久久99精品免费观看| 7777精品久久久大香线蕉| 久久99热这里只频精品6| 久久99精品久久久久久不卡 | 国内精品伊人久久久久av一坑| 亚洲精品无码久久毛片| 久久国产香蕉一区精品| 91精品国产91久久| 久久激情五月丁香伊人| 久久99精品久久久久久不卡| 精品无码久久久久久国产| 国产精品综合久久第一页| 国产亚洲精久久久久久无码AV| 久久电影网一区| 国产99久久九九精品无码|