POJ 1236 Network of Schools (Tarjan + 缩点)
| Time Limit: 1000MS | Memory Limit: 10000K | |
| Total Submissions: 12240 | Accepted: 4871 |
Description
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
Output
Sample Input
5
2 4 3 0
4 5 0
0
0
1 0
Sample Output
1
2
题意:软件发送为有向的,每个学校可以发给list中的其他学校,求:
1.至少发多少个软件才能让所有学校都收到(A)
2.在学校的关系之间加几条边可以让软件发给任意一个学校,其它都可以收到(B)
思路:找图的强连通分量,则A=出度为0的强连通分量个数,B=入度为0的个数和初度为0的个数中较大的一个
找强连通分量:Tarjan算法
POJ 1236 Network of Schools (Tarjan + 缩点)的更多相关文章
- POJ 1236 Network of Schools Tarjan缩点
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22729 Accepted: 89 ...
- Poj 1236 Network of Schools (Tarjan)
题目链接: Poj 1236 Network of Schools 题目描述: 有n个学校,学校之间有一些单向的用来发射无线电的线路,当一个学校得到网络可以通过线路向其他学校传输网络,1:至少分配几个 ...
- POJ 1236 Network of Schools 连通图缩点
题目大意:有向图连通图,第一问求至少需要多少个软件才能传输到所有学校,第二问求至少需要增加多少条路使其成为强连通图 题目思路:利用Tarjan算法经行缩点,第一问就是求缩点后入度为0的点的个数(特殊情 ...
- POJ 1236 Network of Schools —— (缩点的应用)
题目大意:有N个学校和一些有向边将它们连结,求: 1.最少需要向几个学校发放软件,使得他们中的每一个学校最终都能够获得软件. 2.最少需要增加几条有向边使得可以从任意一个学校发放软件,使得每一个学校最 ...
- POJ 1236 Network of Schools(强连通 Tarjan+缩点)
POJ 1236 Network of Schools(强连通 Tarjan+缩点) ACM 题目地址:POJ 1236 题意: 给定一张有向图,问最少选择几个点能遍历全图,以及最少加入�几条边使得 ...
- POJ 1236 Network of Schools(强连通分量)
POJ 1236 Network of Schools 题目链接 题意:题意本质上就是,给定一个有向图,问两个问题 1.从哪几个顶点出发,能走全全部点 2.最少连几条边,使得图强连通 思路: #inc ...
- poj 1236 Network of Schools(又是强连通分量+缩点)
http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Su ...
- [tarjan] poj 1236 Network of Schools
主题链接: http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS Memory Limit: 10000K To ...
- poj 1236 Network of Schools(连通图入度,出度为0)
http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Su ...
随机推荐
- hdu 5752 Sqrt Bo
Sqrt Bo Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total S ...
- libswscale图像格式转换与放大缩小
缩放,例如640x360拉伸为1280x720 注意:没有裁剪! ======================== 有2种使用方法: 简单的初始化方法 (1) sws_getContext ...
- QUnit使用笔记-5简化编写
在测试中,如果用到了大量相同的方法返回判断结果,可以将他们简化; 使用push(): push( result/*boolean,result of assert*/, actual, /*objec ...
- ASP.NET MVC 模型和数据对象映射实践
在使用 MVC 开发项目的过程中遇到了个问题,就是模型和数据实体之间的如何快捷的转换?是不是可以像 Entity Framework 的那样 EntityTypeConfiguration,或者只需要 ...
- 洛谷 P1147 连续自然数和 Label:等差数列
题目描述 对一个给定的自然数M,求出所有的连续的自然数段,这些连续的自然数段中的全部数之和为M. 例子:1998+1999+2000+2001+2002 = 10000,所以从1998到2002的一个 ...
- 像jQuery那样,采用链式方法,封装一个方法:CSS()
主要思路就是:返回this对象,将所获取的操作元素放入一个数组中.在原型中添加拓展方法 <html> <head> <title></title> &l ...
- 8.20 css样式表:样式分类,选择器。样式属性,
样式表分类: 1.内联样式表, 和html联合显示,例:<p style="font-size:14px;">内联样式表</p> 2.内嵌样式表 作为一个独 ...
- Oracle学习整理
用 startup 命令启动数据库,用 shutdown 命令关闭数据库 Oracle SQL 语句由如下命令组成: 数据定义语言(DDL),包括 CREATE (创建)命令.ALTER (修改) ...
- 未能找到Microsoft.Office.Core.MsoTriState的引用
1.首先似乎没有找到这个引用,然后根据网上的教程,添加了Microsoft Office 12.0 Library,根据对象浏览器,查看此dll,有core,也有 MsoTriState也有,编译的时 ...
- uva10098 Generating Fast, Sorted Permutation
#include"iostream"#include"stdio.h"#include"string.h"#include"alg ...