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

            久久人人爽人人爽人人爽| 国产亚洲精久久久久久无码| 色播久久人人爽人人爽人人片aV | 欧美国产精品久久高清| 久久久久久久久久久久久久| 久久精品中文騷妇女内射| 国产精品99久久久久久董美香| 伊人 久久 精品| 久久国产乱子伦免费精品| 久久久久亚洲AV无码去区首| 久久精品国产亚洲AV嫖农村妇女| 国产AⅤ精品一区二区三区久久| 国产精品99久久久久久宅男小说| 99久久成人18免费网站| 久久亚洲美女精品国产精品| 久久婷婷人人澡人人| 免费观看久久精彩视频| 国产成人精品综合久久久| 欧美色综合久久久久久| 热久久这里只有精品| 久久综合给合久久狠狠狠97色 | 99热成人精品免费久久| 亚洲AV无码久久精品蜜桃| 亚洲伊人久久成综合人影院 | 日韩av无码久久精品免费| 亚洲国产日韩欧美综合久久| 国产精品熟女福利久久AV| 久久久青草久久久青草| 国产欧美一区二区久久| 久久婷婷五月综合97色| 久久久久久精品免费免费自慰| 亚洲国产香蕉人人爽成AV片久久| 一级做a爰片久久毛片16| 香蕉久久夜色精品国产小说| 久久青草国产手机看片福利盒子| 99久久777色| 激情综合色综合久久综合| 久久久久久噜噜精品免费直播| 天天做夜夜做久久做狠狠| 中文字幕精品久久| 天天躁日日躁狠狠久久|