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

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

            Copyright © lenohoo

            久久免费大片| 久久久久久综合网天天| 久久久亚洲欧洲日产国码aⅴ | 久久精品水蜜桃av综合天堂| 国产V亚洲V天堂无码久久久| 久久久久亚洲AV综合波多野结衣| 狠狠综合久久AV一区二区三区| 99热成人精品热久久669| 国产巨作麻豆欧美亚洲综合久久 | 午夜不卡久久精品无码免费| 久久免费精品一区二区| 无码人妻久久一区二区三区蜜桃 | 精品久久人人做人人爽综合| 久久夜色精品国产噜噜亚洲AV| 久久99国产精品成人欧美| 伊人久久大香线蕉av一区| 97精品伊人久久久大香线蕉| 久久亚洲精品成人AV| 亚洲国产天堂久久综合| 久久久久AV综合网成人| 欧美麻豆久久久久久中文| 精品久久久久久| 久久亚洲精品无码AV红樱桃| 久久只这里是精品66| 国产免费久久精品99久久| 国产精品久久成人影院| 一本色综合网久久| 亚洲国产小视频精品久久久三级| A级毛片无码久久精品免费| 久久精品国产福利国产秒| av午夜福利一片免费看久久| 久久九九精品99国产精品| 国产色综合久久无码有码| 亚洲精品无码专区久久同性男| 久久亚洲国产精品123区| 久久av高潮av无码av喷吹| 国产精品久久久久久久午夜片| 99久久成人18免费网站| 国内精品久久久久久久亚洲| 久久久WWW成人免费毛片| 国产精品亚洲综合久久|