• <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
            Friendship
            Time Limit: 2000MS Memory Limit: 20000K
            Total Submissions: 1403 Accepted: 294

            Description

            In modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can assume that people A can keep in touch with people B, only if
            1. A knows B's phone number, or
            2. A knows people C's phone number and C can keep in touch with B.
            It's assured that if people A knows people B's number, B will also know A's number.

            Sometimes, someone may meet something bad which makes him lose touch with all the others. For example, he may lose his phone number book and change his phone number at the same time.

            In this problem, you will know the relations between every two among N people. To make it easy, we number these N people by 1,2,...,N. Given two special people with the number S and T, when some people meet bad things, S may lose touch with T. Your job is to compute the minimal number of people that can make this situation happen. It is supposed that bad thing will never happen on S or T.

            Input

            The first line of the input contains three integers N (2<=N<=200), S and T ( 1 <= S, T <= N , and S is not equal to T).Each of the following N lines contains N integers. If i knows j's number, then the j-th number in the (i+1)-th line will be 1, otherwise the number will be 0.

            You can assume that the number of 1s will not exceed 5000 in the input.

            Output

            If there is no way to make A lose touch with B, print "NO ANSWER!" in a single line. Otherwise, the first line contains a single number t, which is the minimal number you have got, and if t is not zero, the second line is needed, which contains t integers in ascending order that indicate the number of people who meet bad things. The integers are separated by a single space.

            If there is more than one solution, we give every solution a score, and output the solution with the minimal score. We can compute the score of a solution in the following way: assume a solution is A1, A2, ..., At (1 <= A1 < A2 <...< At <=N ), the score will be (A1-1)*N^t+(A2-1)*N^(t-1)+...+(At-1)*N. The input will assure that there won't be two solutions with the minimal score.

            Sample Input

            3 1 3
            1 1 0
            1 1 1
            0 1 1
            

            Sample Output

            1
            2
            

            Source

            POJ Monthly
            這道題目,不知道怎么搞的我的最大流一直是超時(shí),有點(diǎn)郁悶,TLM了
            郁悶,代碼 ac后更新
            posted on 2009-02-26 09:46 KNIGHT 閱讀(89) 評(píng)論(0)  編輯 收藏 引用

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


            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(8)

            隨筆檔案

            文章檔案

            Friends

            OJ

            搜索

            •  

            最新評(píng)論

            閱讀排行榜

            評(píng)論排行榜

            国产日韩久久久精品影院首页| 久久无码人妻一区二区三区| 久久亚洲国产精品一区二区| 国产精品永久久久久久久久久| 夜夜亚洲天天久久| 亚洲欧洲精品成人久久曰影片| 青青草原综合久久大伊人| 精品久久久久久久无码 | 亚洲精品乱码久久久久久久久久久久| 精品久久久久久久国产潘金莲| 国产精品久久午夜夜伦鲁鲁| 国产成人无码精品久久久免费| 亚洲国产成人久久综合碰| 无码人妻精品一区二区三区久久久| 久久99精品久久久久子伦| 久久强奷乱码老熟女| 日本人妻丰满熟妇久久久久久| 久久婷婷五月综合97色直播| 欧美激情精品久久久久久久九九九| 97香蕉久久夜色精品国产 | 久久99国产精品久久久| 久久久久国产精品人妻| 人妻丰满?V无码久久不卡| 99久久中文字幕| 久久妇女高潮几次MBA| 欧美午夜A∨大片久久 | 丰满少妇人妻久久久久久4| 无码人妻久久一区二区三区 | 亚洲国产婷婷香蕉久久久久久| 久久精品国产亚洲AV电影| 久久综合亚洲色HEZYO社区| 久久国产高清一区二区三区| AV狠狠色丁香婷婷综合久久| 中文字幕久久久久人妻| 伊人久久五月天| 四虎久久影院| 久久综合久久综合亚洲| 区久久AAA片69亚洲| 精品国产99久久久久久麻豆| 亚洲狠狠婷婷综合久久蜜芽 | 久久狠狠爱亚洲综合影院|