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

            国产美女亚洲精品久久久综合| 91精品国产综合久久精品| 久久99中文字幕久久| AV无码久久久久不卡蜜桃| 久久热这里只有精品在线观看| 久久av高潮av无码av喷吹| 94久久国产乱子伦精品免费| 久久se精品一区精品二区| 青青青国产成人久久111网站| 久久综合欧美成人| 97久久精品人人做人人爽| 精品久久久无码中文字幕天天| 91精品国产91久久久久久| 精品久久久久一区二区三区| 久久精品免费网站网| 亚洲精品WWW久久久久久| 亚洲AV日韩AV天堂久久| 东京热TOKYO综合久久精品| 97精品国产97久久久久久免费| 久久久久亚洲AV无码去区首| 久久久久久伊人高潮影院| 久久精品国产亚洲av麻豆小说| 久久国产免费观看精品| 欧美国产成人久久精品| 一本色道久久综合狠狠躁| 九九99精品久久久久久| 久久青青草原精品国产软件 | 久久精品毛片免费观看| 青青草原综合久久| 国产偷久久久精品专区 | 漂亮人妻被中出中文字幕久久| 精品国产乱码久久久久久呢| 人妻精品久久无码专区精东影业| 亚洲成色999久久网站| 天天影视色香欲综合久久| 精品国产乱码久久久久久郑州公司 | 成人资源影音先锋久久资源网| 久久99精品久久久久久野外| 久久人人爽人人爽人人片AV不 | 国产精品天天影视久久综合网| 久久夜色撩人精品国产|