[题意] 见:http://blog.csdn.net/ascii991/article/details/7466278 [思路] 缩点+tarjan,思路也可以到上面的博客去看.(吐槽:这道题其实我没有AC.我过了当年IOI的数据,而把别人AC掉的程序带进去,明显过不了IOI的数据!求POJ修正一下!)我在这里引用一下: 找强连通分量,缩点.记f[i]为缩完点后的新图中各点入度,g[i]为出度,ans1为f[i]==0的点的数目,ans2为g[i]==0的点的数目则第一问为ans1,第二问则为…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 24880   Accepted: 9900 题目链接:http://poj.org/problem?id=1236 Description: A number of schools are connected to a computer network. Agreements have been developed among thos…
tarjan缩点后,第一问答案显然是入度为零的点得个数第二问:考虑到 没有入度或出度为0的点 的图强连通, 所以答案就是max{入度为零的个数,出度为零的个数} (把出度为零的连到入度为零的点,然后剩下为零的随便连一连就可以) #include<cstdio> #include<cstring> #include<algorithm> #define LL long long int using namespace std; ,maxm=; LL rd(){ LL x=…
http://poj.org/problem?id=1236 (题目链接) 题意 给定一个有向图,求:1.至少要选几个顶点,才能做到从这些顶点出发,可以到达全部顶点:2.至少要加多少条边,才能使得从任何一个顶点出发,都能到达全部顶点. Solution 先用Tarjan缩点,所以原图就变成了一个有向无环图(DAG),问题1很简单,只要找出图中入度为0的点有几个就可以了.而第2问的话,看起来就觉得好麻烦的样子,可是看了题解后发现原来如此简单..用ans1记录入度为0的点的个数,ans2记录出度为0…
http://poj.org/problem?id=1236 首先还是缩点,然后入度为0的点的个数就是你要投文件个数. 然后我们对于入度和出度为0的点的个数取最大值即为答案. (简单证明:入度和出度为0的点可以互相连一下成一个环,但是无法匹配的时候就只能随便连了) #include<stack> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> us…
转载请注明出处,谢谢:http://www.cnblogs.com/KirisameMarisa/p/4316263.html  ---by 墨染之樱花 [题目链接]http://poj.org/problem?id=1236 [题目描述]给一张有向图,表示学校通信网络,边<u,v>代表信息可以由u传递到v.现要完成两个任务:1.求最少把几个点作为信息传递的起点就能让信息转达到所有节点 2.最少在添加几条边就能使任意两点间可达(构造强连通分量) [思路]先利用tarjan缩点使整个图化为DAG…
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: 10000K 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 softwa…
                                                 Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5354   Accepted: 2106 Description A number of schools are connected to a computer network. Agreements have been developed…
                                                            Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 16343   Accepted: 6484 Description A number of schools are connected to a computer network. Agreements have be…
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…
POJ 1236 Network of Schools(强连通 Tarjan+缩点) ACM 题目地址:POJ 1236 题意:  给定一张有向图,问最少选择几个点能遍历全图,以及最少加入�几条边使得有向图成为一个强连通图. 分析:  跟HDU 2767 Proving Equivalences(题解)一样的题目,只是多了个问题,事实上转化成DAG后就不难考虑了,事实上仅仅要选择入度为0的点即可了. 代码: /* * Author: illuz <iilluzen[at]gmail.com>…
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…
Network of Schools 题意:若干个学校组成一个计算机网络系统,一个学校作为出发端连接着若干个学校,信息可以传送到这些学校.被链接的学校不需要再次与出发端相连,现在问你:A:最少选几个学校作为出发端其他所有的学校都能接收到信息,B:如果任意选一个学校作为出发端使得其他所有学校都能接收到信息,最少需要再搭建几条网线. 思路:用Tarjan算法求出所有的连通分量,然后将这些分量作为一个点进行连接(缩点).答案A既是入度为0的点的数量,答案B:一条网线可以作为一个出度和一个入度,所以答案…
题目链接:http://poj.org/problem?id=1236 Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 19859   Accepted: 7822 Description A number of schools are connected to a computer network. Agreements have been developed among those…
P2746 [USACO5.3]校园网Network of Schools https://www.luogu.org/problem/P2746 题目描述 一些学校连入一个电脑网络.那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作"接受学校").注意即使 B 在 A 学校的分发列表中, A 也不一定在 B 学校的列表中. 你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A).更进一步,我们想要确定通过给任意一…
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…
题意 给出一个有向图,A任务:求最少需要从几个点送入信息,使得信息可以通过有向图走遍每一个点B任务:求最少需要加入几条边,使得有向图是一个强联通分量 思路 任务A,比较好想,可以通过tarjan缩点,求出入度为0的点的个数任务B一开始以为任务A,B没有关系其实是入度为0的点的个数.出度为0的点的个数的最大值.因为任务B要求在任意学校投放软件使得所有学校都能收到,所以很明显是需要整张图形成一个环,而环中所有节点入度和出度都不为0,所以需要把所有入度和出度的点度数增加. (注意判断本身就全联通的情况…
P2746 [USACO5.3]校园网Network of Schools// POJ1236: Network of Schools 题目描述 一些学校连入一个电脑网络.那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作“接受学校”).注意即使 B 在 A 学校的分发列表中, A 也不一定在 B 学校的列表中. 你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A).更进一步,我们想要确定通过给任意一个学校发送新软件,这个…
Network of Schools Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 27121   Accepted: 10704 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a l…
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…
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…
题目链接: Poj 1236 Network of Schools 题目描述: 有n个学校,学校之间有一些单向的用来发射无线电的线路,当一个学校得到网络可以通过线路向其他学校传输网络,1:至少分配几个网络才能够让所有学校被网络覆盖?2:至少要加几条线路就能做到在任意一个学校安装网络都可以覆盖全部学校? 解题思路: 先用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…
主题链接: 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: 13801   Accepted: 5505 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li…
P2746 [USACO5.3]校园网Network of Schools 题目描述 一些学校连入一个电脑网络.那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作“接受学校”).注意即使 B 在 A 学校的分发列表中, A 也不一定在 B 学校的列表中. 你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A).更进一步,我们想要确定通过给任意一个学校发送新软件,这个软件就会分发到网络中的所有学校.为了完成这个任务,我们可能必…
nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. ---------------------------------------------------------------------------------- #include<cstdio> #include<iostream> #include<algorithm> #includ…
题目描述 一些学校连入一个电脑网络.那些学校已订立了协议:每个学校都会给其它的一些学校分发软件(称作“接受学校”).注意即使 B 在 A 学校的分发列表中, A 也不一定在 B 学校的列表中. 你要写一个程序计算,根据协议,为了让网络中所有的学校都用上新软件,必须接受新软件副本的最少学校数目(子任务 A).更进一步,我们想要确定通过给任意一个学校发送新软件,这个软件就会分发到网络中的所有学校.为了完成这个任务,我们可能必须扩展接收学校列表,使其加入新成员.计算最少需要增加几个扩展,使得不论我们给…