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

            精品久久久久国产免费| 精品久久8x国产免费观看| 激情五月综合综合久久69| 久久婷婷人人澡人人| 久久婷婷五月综合色高清| 国产精品对白刺激久久久| 亚洲午夜久久久精品影院| 囯产精品久久久久久久久蜜桃| 久久久久四虎国产精品| 久久久久亚洲AV成人片| 99久久精品九九亚洲精品| 亚洲精品美女久久777777| 色欲综合久久躁天天躁| 99国内精品久久久久久久| 久久夜色精品国产亚洲| 久久国产精品一区| 国产一区二区三精品久久久无广告| 久久超乳爆乳中文字幕| 久久精品欧美日韩精品| 久久亚洲欧美国产精品| 欧美一区二区三区久久综合| 欧美噜噜久久久XXX| 久久精品国产精品亚洲精品| 久久99国产精品二区不卡| 国产精品免费久久| 欧美久久久久久| 久久婷婷五月综合色高清| 国产成人久久精品二区三区| 99久久成人18免费网站| 久久无码国产| AV色综合久久天堂AV色综合在| 久久福利青草精品资源站| 国产精品热久久毛片| 久久久久人妻一区精品果冻| 99久久综合国产精品免费| A狠狠久久蜜臀婷色中文网| 久久天天躁狠狠躁夜夜2020 | 国产香蕉97碰碰久久人人| 亚洲国产小视频精品久久久三级| 韩国免费A级毛片久久| 亚洲а∨天堂久久精品9966|