• <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>
            Network of Schools

            Description

            A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving schools”). Note that if B is in the distribution list of school A, then A does not necessarily appear in the list of school B
            You are to write a program that computes the minimal number of schools that must receive a copy of the new software in order for the software to reach all schools in the network according to the agreement (Subtask A). As a further task, we want to ensure that by sending the copy of new software to an arbitrary school, this software will reach all schools in the network. To achieve this goal we may have to extend the lists of receivers by new members. Compute the minimal number of extensions that have to be made so that whatever school we send the new software to, it will reach all other schools (Subtask B). One extension means introducing one new member into the list of receivers of one school.

            Input

            The first line contains an integer N: the number of schools in the network (2 <= N <= 100). The schools are identified by the first N positive integers. Each of the next N lines describes a list of receivers. The line i+1 contains the identifiers of the receivers of school i. Each list ends with a 0. An empty list contains a 0 alone in the line.

            Output

            Your program should write two lines to the standard output. The first line should contain one positive integer: the solution of subtask A. The second line should contain the solution of subtask B.

            Sample Input

            5 2 4 3 0 4 5 0 0 0 1 0 

            Sample Output

            1 2 

            Source


            adjacnet Matric

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


            posts - 3, comments - 1, trackbacks - 0, articles - 16

            Copyright © lenohoo

            久久婷婷成人综合色综合| 成人国内精品久久久久一区| 亚洲国产成人久久综合一| 久久噜噜电影你懂的| 久久www免费人成看国产片| 日韩AV毛片精品久久久| 一本色道久久99一综合| 久久久久国产精品| 久久人妻少妇嫩草AV蜜桃| 国产∨亚洲V天堂无码久久久| A级毛片无码久久精品免费| 97精品伊人久久大香线蕉| 久久91精品国产91久久麻豆| 久久久黄片| 精品久久一区二区三区| 97精品伊人久久久大香线蕉| 久久男人AV资源网站| 久久国产精品久久| 午夜精品久久久久久99热| 久久亚洲国产成人精品无码区| 久久精品九九亚洲精品| 青青草原综合久久大伊人| 精品久久久久中文字| 狠色狠色狠狠色综合久久 | 久久久国产打桩机| 国产亚州精品女人久久久久久| 精品熟女少妇a∨免费久久| 久久久久99这里有精品10| 久久久精品久久久久特色影视| 69久久夜色精品国产69| 午夜精品久久久久久毛片| 久久精品亚洲AV久久久无码| 伊人久久成人成综合网222| 国产精品免费久久久久久久久| 99久久综合狠狠综合久久止| 久久国产精品无码一区二区三区| 亚洲va久久久噜噜噜久久男同| 99久久精品免费看国产一区二区三区| 久久亚洲电影| 久久久久久亚洲精品影院| 综合久久一区二区三区 |