POJ 1236 Network of Schools[连通分量]】的更多相关文章

题目链接:http://poj.org/problem?id=1236题目大意:给出N台电脑,电脑间单向连通传送文件问题1.网络中最少放几个文件保证所有电脑都能接受到文件问题2.最少向网络中加几条线保证任意放1个文件所有电脑都能接受到解题思路:1.求出强连通分量2.缩点 ,进行重新构图3.如果入度为0,说明没有文件传输到该网络.解决问题1,统计入度为0的个数即可4.一个强连通图的入度和出度都不为0.入度为0相当于根root,出度为0相当于叶子leave.max(root, leave)即为答案.…
POJ 1236 Network of Schools(强连通 Tarjan+缩点) ACM 题目地址:POJ 1236 题意:  给定一张有向图,问最少选择几个点能遍历全图,以及最少加入�几条边使得有向图成为一个强连通图. 分析:  跟HDU 2767 Proving Equivalences(题解)一样的题目,只是多了个问题,事实上转化成DAG后就不难考虑了,事实上仅仅要选择入度为0的点即可了. 代码: /* * Author: illuz <iilluzen[at]gmail.com>…
POJ 1236 Network of Schools 题目链接 题意:题意本质上就是,给定一个有向图,问两个问题 1.从哪几个顶点出发,能走全全部点 2.最少连几条边,使得图强连通 思路: #include <cstdio> #include <cstring> #include <vector> #include <stack> using namespace std; const int N = 105; int n; vector<int>…
题目链接: Poj 1236 Network of Schools 题目描述: 有n个学校,学校之间有一些单向的用来发射无线电的线路,当一个学校得到网络可以通过线路向其他学校传输网络,1:至少分配几个网络才能够让所有学校被网络覆盖?2:至少要加几条线路就能做到在任意一个学校安装网络都可以覆盖全部学校? 解题思路: 先用Tarjan对强连通分量进行缩点,然后对缩点以后的图进行处理,统计图中节点出度为零的有多少,入度为零的有多少个? 因为入度为零的点不能由其他的点到达,在每个入度为零的节点安装网络可…
http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9481   Accepted: 3767 Description A number of schools are connected to a computer network. Agreements have been developed among those schoo…
http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13046   Accepted: 5215 Description A number of schools are connected to a computer network. Agreements have been developed among those scho…
主题链接: http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11433   Accepted: 4551 Description A number of schools are connected to a computer network. Agreements have been developed among thos…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16806   Accepted: 6643 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
Network of Schools Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1236 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: e…
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…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16803   Accepted: 6641 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12240   Accepted: 4871 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 9073   Accepted: 3594 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a lis…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 13800   Accepted: 5504 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22745   Accepted: 8929 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
Network of Schools 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 t…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 22729   Accepted: 8926 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
POJ 1236 :http://poj.org/problem?id=1236 参考:https://www.cnblogs.com/TnT2333333/p/6875680.html 题意: 有好多学校,每个学校可以给其他特定的学校发送文件.第一个问题是最少要给几个学校发文件,可以使得全部的学校收到文件.第二个问题是最少要加几条线路,使得随意挑一个学校发文件,也能使得全部的学校收到文件. 思路: 第一个问题,可以用tarjan给图中先缩点,因为强连通的环相互可达.所以只要数出缩完点后图中入度…
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…
传送门 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…
题目链接:http://poj.org/problem?id=1236 题目大意:有一些学校,学校之间可以进行收发邮件,给出学校的相互关系,问:1.至少 要向这些学校发送多少份才能使所有的学校都能获得邮件:2.若想只发送一份即可让所有学 校都能收到邮件,则至少需要需要再进行多少次学校之间的连接. 学校之间的关系可构成图,将图进行强连通缩点成块儿后可知,每个进入数为0的点需要发 送一份:若想要所有点都连接,则需要连接数目为max(入度为0点数,出度为0点数),这 个是结论,详细证明不再贴. 代码如…
题目链接:http://poj.org/problem?id=1236 题意:给定一个表示n所学校网络连通关系的有向图.现要通过网络分发软件,规则是:若顶点u,v存在通路,发给u,则v可以通过网络从u接收到. 现要求解两个问题: TaskA: 最少分发给几个学校,就可以使所有的学校都能得到软件. TaskB: 最少增加几条边,就可以使得,发软件给任一学校,所有学校都可以收到. 思路:先进行强联通分量分解,然后缩点,并计算缩点后每个点的出度.入度.入度为0的点的总数为 a ,出度为0的点总数为 b…
题目链接:http://poj.org/problem?id=1236 题目大意: 给你一个网络(有向图),有两个任务: ①求出至少同时需要几份副本可以使得整个网络都获得副本 ②至少添加多少信息表(有向边)使得副本传到任一点,都可以使得整个网络都获得副本 解题思路: 即给定一个有向图,求: ①至少要选几个顶点,才能做到从这些顶点出发,可以到达全部顶点 ②至少要加多少条边,才能使得从任何一个顶点出发,都能到达全部顶点缩点后,分别求出出度入度为0的点数为sum1,sum2,问题①的答案就为sum2;…
题目链接:http://poj.org/problem?id=1236 题意: 本题为有向图. 需解决两个问题: 1 须要给多少个点,才干传遍全部点. 2 加多少条边,使得整个图变得强连通. 使用Tarjan进行缩点,得到一个SCC图. 这个图有多少个入度为0的,多少个出度为0的. 如果有n个入度为0,m个出度为0 那么第一个答案就是n,第二个答案是max(n,m) 代码: #include <stdio.h> #include <iostream> #include <ma…
/** problem: http://poj.org/problem?id=1236 缩点后入度为0的点的总数为需要发放软件的学校个数 缩点后出度为0的点的总数和入度为0的点的总数的最大值为需要增加的传输线路的条数(头尾相接) 特别的,当图为强连通图时,发放软件的学校个数为1, 增加线路为0 **/ #include<stdio.h> #include<stack> #include<algorithm> using namespace std; class Grap…
[题目链接] http://poj.org/problem?id=1236 [题目大意] 给出一张有向图,问需要从几个起点出发才能遍历全图, 如果要求从任何一个点出发都能遍历全图,那么最少需要增加几条边 [题解] 先求出SCC,那么对于对于第一问,就是入度为0的SCC数量, 第二问是入度为0和出度为0的SCC数量较大的一个. [代码] #include <cstdio> #include <algorithm> #include <vector> #include &l…
poj.org/problem?id=1236 [题意] 给定一个有向图,求: (1)至少要选几个顶点,才能做到从这些顶点出发,可以到达全部顶点 (2)至少要加多少条边,才能使得从任何一个顶点出发,都能到达全部顶点 [思路] (1)强连通分量缩点后形成一个有向无环图,只要选择入度为0的顶点,其他顶点都可以被到达 (2)等价于一个有向无环图加最少加多少条边能够变成一个强连通图,取出度为0的点的个数和入度为0的点的个数的max,因为出度为0的点要加一条出边,入度为0的点要加一条入边 (2)特判特殊情…
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…
这个题目网上有很多答案,代码也很像,不排除我的.大家的思路应该都是taijan求出割边,然后找两个点的LCA(最近公共祖先),这两个点和LCA以及其他点构成了一个环,我们判断这个环上的割边有几条,我们的答案就少几个. 有人问,这个题重边怎么办呢,重边肯定不是桥啊.额……对于这个我只能说,这个题的原始图应该是没有重边的,后来加的边可能会有重边,不过不影响我们的判断,因为我们通过标记点的方式去判的.(这个题还是应该说明一下啊,题目有点问题……). 其次,这个题的好玩之处来了,网上人分享的代码,居然过…
<题目链接> 题目大意: 有N个学校,每个学校之间单向可以发送软件,现在给你一些学校之间的收发关系.问你下面两个问题:至少要给多少个学校发送软件才能使得最终所有学校都收到软件:至少要多加多少个关系才能使得向任意一个学校发送一套软件,每个学校都能收到软件.  解题分析: 首先,对该图进行缩点,显然第一问问的就是,缩点后的入度为0的联通块的数量(因为这些点没有入度,必须人为的给它们软件,它们才能接收到软件):第二问,显然就是问至少要加多少条边,使得该图变为强连通图,强连通图有个条件,就是所有的点一…