[poj] 1236 networks of schools】的更多相关文章

原题 这是一道强连通分量板子题. 显然subtask1 是要输出入度为0的点的个数 而subtask2,我们考虑一下最优一定是把一个出度为零的点连到入度为零的点上,这样我们要输出的就是max(出度为零的个数,入度为零的个数) 另外,如果只有一个强连通分量,那么subtask2答案是0 #include<cstdio> #include<algorithm> #include<stack> #define N 10010 #define M 50010 using nam…
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对强连通分量进行缩点,然后对缩点以后的图进行处理,统计图中节点出度为零的有多少,入度为零的有多少个? 因为入度为零的点不能由其他的点到达,在每个入度为零的节点安装网络可…
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…
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: 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: 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: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…
POJ 1236 :http://poj.org/problem?id=1236 参考:https://www.cnblogs.com/TnT2333333/p/6875680.html 题意: 有好多学校,每个学校可以给其他特定的学校发送文件.第一个问题是最少要给几个学校发文件,可以使得全部的学校收到文件.第二个问题是最少要加几条线路,使得随意挑一个学校发文件,也能使得全部的学校收到文件. 思路: 第一个问题,可以用tarjan给图中先缩点,因为强连通的环相互可达.所以只要数出缩完点后图中入度…