POJ1236解题报告 强连通分支+缩点
来源:互联网 发布:java自定义日志输出 编辑:程序博客网 时间:2024/06/10 21:33
Network of Schools
Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 4177 Accepted: 1636
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.
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
52 4 3 04 5 0001 0
Sample Output
12
题意:有若干个学校,每个学校可以向某些学校提供软件,第一问:最初至少应该发给几个学校软件才能保证所有学校都能得到软件?
第二问:至少要新添加几条网络才能将关系图变为强连通图?
tarjan第三题
思路:第一个问比较简单,用tarjan求出强连通分量缩点后,求入度为0的缩点数,第二问没想出来,看别人的解题报告才知道求的是
0入度缩点和0出度缩点较大的值。。太菜了~
- POJ1236解题报告 强连通分支+缩点
- poj1236 强连通分支+缩点
- POJ2186解题报告 强连通分支+缩点
- POJ1236强连通+缩点
- 强连通分量+缩点-poj1236
- poj1236强连通分量+缩点
- poj1236 强连通分量+缩点
- poj1236(*强连通分量,缩点)
- POJ2553解题报告 强连通分支
- POJ1236 Network of Schools 强连通+缩点
- poj1236 强连通分量——缩点
- POJ1236--Network of Schools(强连通+缩点)
- poj1236 Network of Schools(强连通-缩点)
- POJ1236 Network of Schools 强连通+缩点
- POJ1236【图的强连通(缩点)】
- POJ1236 Network of Schools(缩点+结论+强连通分量)
- POJ1236 强连通分支(strongly connected component _kosaraju algorithm)
- HDU1827 Summer Holiday 解题报告【tarjan/强连通分量+缩点】
- 网上看到的一个统计代码行工具
- 网上看到的一个统计代码行工具
- 【转】java.lang.Integer.toHexString(b[n] & 0XFF)中0XFF使用的必要性
- Android AudioManager控制系统声音的流程
- What is the difference between objectForKey and valueForKey?
- POJ1236解题报告 强连通分支+缩点
- 正确理解CRITICAL_SECTION
- MyEclipse小结
- UpdateData函数的 wincore.cpp Line:883错误
- div 和 span 的区别
- TinyMCE 编辑器
- 文本挖掘经典书籍推荐—THE TEXT MINING HANDBOOK(Advd. Approaches in Analyzing Unstructured Data)
- 芬兰VTT公司的研究报告:Data Mining Tools for Technology, 2008
- Ogre 1.7.2 SDKTrays 汉化