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

            国产免费久久精品丫丫| 久久久久亚洲av无码专区导航| 国产精品无码久久久久久| 久久精品国产亚洲AV无码娇色 | 久久精品国产精品亚洲下载 | 亚洲AV无码1区2区久久| 精品久久久久久久| 亚洲另类欧美综合久久图片区| 无码人妻少妇久久中文字幕蜜桃| 久久久中文字幕| 久久久久人妻一区二区三区| 欧美精品一本久久男人的天堂| 伊人久久大香线蕉成人| 国产亚洲欧美成人久久片| 日韩电影久久久被窝网| 国产精品久久久久久久久鸭| 久久人人爽人人爽人人片av麻烦| 日本免费一区二区久久人人澡| 久久久久久久97| 欧美久久久久久午夜精品| 国产成人无码久久久精品一| 久久久久亚洲精品日久生情| 久久久久99精品成人片| 国产精品久久久久影视不卡| 久久综合给久久狠狠97色| 伊人 久久 精品| 久久久久亚洲精品无码网址| 99热成人精品免费久久| 久久er国产精品免费观看2| 亚洲国产精品无码久久98| 婷婷久久五月天| 天堂无码久久综合东京热| 久久高潮一级毛片免费| 99久久精品国产一区二区| 久久精品国产福利国产秒| 欧美噜噜久久久XXX| 欧美日韩精品久久久久| 久久久久久久波多野结衣高潮| 久久久久久久精品成人热色戒 | 久久久精品日本一区二区三区| 97精品国产91久久久久久|