[IOI1996] USACO Section 5.3 Network of Schools(强连通分量)
nocow上的题解很好。 http://www.nocow.cn/index.php/USACO/schlnet
如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断。
----------------------------------------------------------------------------------
----------------------------------------------------------------------------------
Network of Schools
IOI '96 Day 1 Problem 3
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.
PROGRAM NAME: schlnet
INPUT FORMAT
The first line of the input file 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.
SAMPLE INPUT (file schlnet.in)
5 2 4 3 0 4 5 0 0 0 1 0
OUTPUT FORMAT
Your program should write two lines to the output file. The first line should contain one positive integer: the solution of subtask A. The second line should contain the solution of subtask B.
SAMPLE OUTPUT (file schlnet.out)
1 2
[IOI1996] USACO Section 5.3 Network of Schools(强连通分量)的更多相关文章
- Network of Schools(强连通分量缩点(邻接表&矩阵))
Description A number of schools are connected to a computer network. Agreements have been developed ...
- Network of Schools(强连通分量+缩点) (问添加几个点最少点是所有点连接+添加最少边使图强连通)
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13801 Accepted: 55 ...
- POJ 1236 Network Of Schools (强连通分量缩点求出度为0的和入度为0的分量个数)
Network of Schools A number of schools are connected to a computer network. Agreements have been dev ...
- POJ1236 Network of Schools —— 强连通分量 + 缩点 + 入出度
题目链接:http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS Memory Limit: 10000K Tot ...
- poj-1236.network of schools(强连通分量 + 图的入度出度)
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 27121 Accepted: 10 ...
- POJ1236 Network of Schools (强连通分量,注意边界)
A number of schools are connected to a computer network. Agreements have been developed among those ...
- POJ 1236 Network of Schools (强连通分量缩点求度数)
题意: 求一个有向图中: (1)要选几个点才能把的点走遍 (2)要添加多少条边使得整个图强联通 分析: 对于问题1, 我们只要求出缩点后的图有多少个入度为0的scc就好, 因为有入度的scc可以从其他 ...
- POJ1236Network of Schools[强连通分量|缩点]
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 16571 Accepted: 65 ...
- poj~1236 Network of Schools 强连通入门题
一些学校连接到计算机网络.这些学校之间已经达成了协议: 每所学校都有一份分发软件的学校名单("接收学校"). 请注意,如果B在学校A的分发名单中,则A不一定出现在学校B的名单中您需 ...
随机推荐
- NOI2015 Day2
NOI2015 Day2 荷马史诗 题目描述:给出\(n\)个数,要求\(n\)个\(k\)进制数来对应这\(k\)个数(允许有前导零),\(n\)个\(k\)进制数互不为前缀,求\(n\)个数乘以对 ...
- ajax、form提交乱码
ajax 传参乱码:encodeURI(encodeURI(username)) form 传参乱码:request.setCharacterEncoding("UTF-8"); ...
- poj2350
#include <stdio.h> #include <stdlib.h> int main() { ],tim,i; scanf("%d",&n ...
- mac下通过xcodebuild使用oclint
step1 :下载oclint并安装 下载地址: http://oclint.org/downloads.html 选择mac os x或者darwin的包,下载到本地. 文件夹类似以下: oclin ...
- HP DL360 G7通过iLO部署系统
HPDL360 G7通过iLO部署系统 HP DL360 G7是没有光驱的服务器,可使用USB外置光驱.PXE网络安装.ILO方式的安装操作系统 一.HP iLO 简介 iLO 是一组芯片,内部是vx ...
- JavaScript之arguments.callee
arguments.callee 在哪一个函数中运行,它就代表哪个函数. 一般用在匿名函数中. 在匿名函数中有时会需要自己调用自己,但是由于是匿名函数,没有名子,无名可调. 这时就可以用argumen ...
- 通过SecureCRT下载远程Linux服务器上的文件到本地Windows
sz 文件名[先cd到需要下载的文件的目录层] [root@is13084905-0233 bookinterface]# sz test.txt rz Starting zmodem transf ...
- 读数据库所有表和表结构的sql语句
SQL获取所有数据库名.表名.储存过程以及参数列表 1.获取所有用户名:SELECT name FROM Sysusers where status='2' and islogin='1'islogi ...
- Unity StrangeIoc框架 (二)
MVCSContex :the big picture 1.应用程序的入口是一个类成为ContextView,这是一个Monobehavior实例化MVCSContext 2.用MVCSContext ...
- 像jq那样获取对象的js原生方法
使用过jq的童鞋非常喜欢jq获取对象的方法,只要$()就可以获取,在此我封装一个js获取对象的方法 [注意]只对chrome,Firefox,opera,Safari,ie8及ie8以上版本有效 fu ...