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

            99久久中文字幕| 国产91久久综合| 男女久久久国产一区二区三区| 久久99精品久久久久久动态图| 久久免费美女视频| 久久人做人爽一区二区三区| 亚洲精品无码久久久久久| 国产亚洲美女精品久久久久狼| 欧美综合天天夜夜久久| 2019久久久高清456| 久久天堂电影网| 久久久亚洲欧洲日产国码二区| 国产—久久香蕉国产线看观看| 午夜人妻久久久久久久久| 久久艹国产| 久久精品国产亚洲欧美| 性做久久久久久久| 一极黄色视频久久网站| 99久久人人爽亚洲精品美女| 国内精品九九久久久精品| 久久久久久久91精品免费观看 | 久久精品人人做人人爽电影 | 久久一区二区三区免费| 久久精品aⅴ无码中文字字幕不卡| 久久综合日本熟妇| 精品久久久久久国产三级| 九九久久99综合一区二区| 久久不见久久见免费视频7| 久久精品国产亚洲av麻豆蜜芽| 蜜桃麻豆www久久国产精品| 蜜桃麻豆www久久| 亚洲国产精品久久66| 韩国无遮挡三级久久| 久久综合久久综合久久综合| 久久噜噜电影你懂的| 青青热久久综合网伊人| 麻豆精品久久精品色综合| 国产免费久久久久久无码| 久久五月精品中文字幕| 一本一本久久a久久精品综合麻豆| 三级三级久久三级久久|