/** problem: http://poj.org/problem?id=1236 缩点后入度为0的点的总数为需要发放软件的学校个数 缩点后出度为0的点的总数和入度为0的点的总数的最大值为需要增加的传输线路的条数(头尾相接) 特别的,当图为强连通图时,发放软件的学校个数为1, 增加线路为0 **/ #include<stdio.h> #include<stack> #include<algorithm> using namespace std; class Grap…
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: 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 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…
题意: 求一个有向图中: (1)要选几个点才能把的点走遍 (2)要添加多少条边使得整个图强联通 分析: 对于问题1, 我们只要求出缩点后的图有多少个入度为0的scc就好, 因为有入度的scc可以从其他地方到达. 对于问题2, 每个入度为0的scc, 都可以补一条边可以变成强连通图, 每个出度为0的scc, 也可以补一条边使其变成强连通图. 所以答案就是max(入度为0scc个数,出度为0scc个数). #include<cstdio> #include<iostream> #inc…
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 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…
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…
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 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: 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 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: 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…
题目大概: 每个学校都可以把软件复制好,交给它名单上的学校. 问题A:把软件复制成几份,然后交给不同的学校,所有学校才能够都有软件. 问题B:添加几条边,能使得这个图变成强连通图. 思路: 找出所有的强连通分量,然后缩点,变成一个新有向无环图,求每个强连通分量的入度和出度. A:入度是0的点就是复制的最小数量,因为只要给强连通分量一个软件,他就会传到每个点,所以找出没有入口的强连通分量的数量就是要复制的数量(其他强连通分量都可以由这些分量传递过去). B:in0为入度为0点的数量,out0出度为…
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给图中先缩点,因为强连通的环相互可达.所以只要数出缩完点后图中入度…
一些学校连接到计算机网络.这些学校之间已经达成了协议: 每所学校都有一份分发软件的学校名单("接收学校"). 请注意,如果B在学校A的分发名单中,则A不一定出现在学校B的名单中您需要编写一个计划,计算必须接收新软件副本的最少学校数量, 以便软件根据协议(子任务A)到达网络中的所有学校.作为进一步的任务, 我们希望确保通过将新软件的副本发送到任意学校,该软件将覆盖网络中的所有学校. 为了实现这一目标,我们可能需要扩大新成员的接收者名单. 计算必须做的扩展的最小数目,以便我们发送新软件的任…
d.各学校之间有单向的网络,每个学校得到一套软件后,可以通过单向网络向周边的学校传输, 问题1:初始至少需要向多少个学校发放软件,使得网络内所有的学校最终都能得到软件. 问题2:至少需要添加几条传输线路(边),使任意向一个学校发放软件后,经过若干次传送,网络内所有的学校最终都能得到软件.s.首先找强连通分量,然后看强连通分量的入度为0点的总数,出度为0点的总数. 第一问为入度为0的强连通分量的个数. 第二问为入度为0的个数和出度为0的个数中大的.(将这个图的所有子树找出来,然后将一棵子树的叶子结…
Description 一些学校连入一个电脑网络.那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作“接受学校”).注意如果 B 在 A 学校的分发列表中,那么 A 不必也在 B 学校的列表中. 你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A).更进一步,我们想要确定通过给任意一个学校发送新软件,这个软件就会分发到网络中的所有学校.为了完成这个任务,我们可能必须扩展接收学校列表,使其加入新成员.计算最少需要增加几个扩展…
Redundant Paths Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11047   Accepted: 4725 Description In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the…
题目链接:http://poj.org/problem?id=1236 题目大意: 给你一个网络(有向图),有两个任务: ①求出至少同时需要几份副本可以使得整个网络都获得副本 ②至少添加多少信息表(有向边)使得副本传到任一点,都可以使得整个网络都获得副本 解题思路: 即给定一个有向图,求: ①至少要选几个顶点,才能做到从这些顶点出发,可以到达全部顶点 ②至少要加多少条边,才能使得从任何一个顶点出发,都能到达全部顶点缩点后,分别求出出度入度为0的点数为sum1,sum2,问题①的答案就为sum2;…
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题目大意:给出N台电脑,电脑间单向连通传送文件问题1.网络中最少放几个文件保证所有电脑都能接受到文件问题2.最少向网络中加几条线保证任意放1个文件所有电脑都能接受到解题思路:1.求出强连通分量2.缩点 ,进行重新构图3.如果入度为0,说明没有文件传输到该网络.解决问题1,统计入度为0的个数即可4.一个强连通图的入度和出度都不为0.入度为0相当于根root,出度为0相当于叶子leave.max(root, leave)即为答案.…