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

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

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

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


            <2009年5月>
            262728293012
            3456789
            10111213141516
            17181920212223
            24252627282930
            31123456

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久久青草久久久青草| 欧美精品一区二区久久| 亚洲AV乱码久久精品蜜桃| 欧美大香线蕉线伊人久久| 久久精品成人免费看| 久久久久综合中文字幕| 亚洲av成人无码久久精品 | 91精品国产9l久久久久| 久久精品99无色码中文字幕| 精品国产乱码久久久久久呢| 99精品久久久久久久婷婷| 亚洲午夜久久久久久久久电影网 | 久久毛片免费看一区二区三区| 国产69精品久久久久APP下载 | 97久久久久人妻精品专区| 亚洲精品久久久www| 99久久夜色精品国产网站| 精品一二三区久久aaa片| 久久天天躁狠狠躁夜夜2020| 99精品久久精品一区二区| 7777精品伊人久久久大香线蕉| 国产91久久综合| 91精品婷婷国产综合久久| 久久久久99精品成人片欧美| 久久夜色精品国产噜噜亚洲a| 精品久久久久久国产三级| 99re这里只有精品热久久| 日韩人妻无码一区二区三区久久| 欧美性大战久久久久久| 国内精品久久久久久中文字幕| 国产精品久久久久久影院 | 中文成人久久久久影院免费观看| 国产精品免费久久| 国内精品久久久久久不卡影院| 青青草原综合久久| 国产成人久久精品麻豆一区| 久久国产欧美日韩精品| 国产精品一区二区久久国产| 亚洲国产精品无码久久| 欧美噜噜久久久XXX| 91久久精一区二区三区大全|