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

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


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

            Copyright © lenohoo

            久久精品国产亚洲77777| 久久精品国产精品青草| 青青草原综合久久大伊人| 久久精品中文字幕大胸| 亚洲国产精品一区二区久久hs| 亚洲AV日韩AV永久无码久久| 久久久久中文字幕| 欧美黑人激情性久久| 久久青青草原综合伊人| 国产精品乱码久久久久久软件 | 久久这里有精品视频| 色诱久久久久综合网ywww| 精品一久久香蕉国产线看播放| 精品久久久久久国产| 久久精品无码专区免费| 久久ZYZ资源站无码中文动漫| 久久综合精品国产一区二区三区 | 品成人欧美大片久久国产欧美| 久久亚洲天堂| 久久国产视屏| 四虎国产精品免费久久5151| 久久国产精品成人影院| 精品人妻伦九区久久AAA片69| 久久电影网| 色噜噜狠狠先锋影音久久| 国产亚洲综合久久系列| 久久婷婷国产剧情内射白浆| 久久亚洲国产精品五月天婷| 伊人热人久久中文字幕| 久久91精品国产91久久小草| 无遮挡粉嫩小泬久久久久久久| 久久亚洲中文字幕精品一区| 久久夜色tv网站| 一级做a爱片久久毛片| 国产精品九九九久久九九| 97精品伊人久久大香线蕉app | 国产亚洲精久久久久久无码| 亚洲精品乱码久久久久久| 色综合久久无码中文字幕| 色8久久人人97超碰香蕉987| 丁香狠狠色婷婷久久综合|