题目地址:id=1144">POJ 1144 求割点.推断一个点是否是割点有两种推断情况: 假设u为割点,当且仅当满足以下的1条 1.假设u为树根,那么u必须有多于1棵子树 2.假设u不为树根.那么(u,v)为树枝边.当Low[v]>=DFN[u]时. 然后依据这两句来找割点就能够了. 代码例如以下: #include <iostream> #include <cstdio> #include <string> #include <cstri…
Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 11042   Accepted: 5100 Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N…
Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12707   Accepted: 5835 Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N…
Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 17016   Accepted: 7635 Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N…
题目链接:poj 1144 题意就是说有 n(标号为 1 ~ n)个网点连接成的一个网络,critical places 表示删去后使得图不连通的顶点,也就是割顶,求图中割顶的个数. 直接上大白书上的模板即可,只是输入也有点卡人,我竟然傻傻的用手写的输入挂来处理,看了别人的博客才知道用 scanf("%s") 即可,因为 scanf("%s") 不会读入空格,再适当处理下即可. 我的代码是: #include<cstdio> #include<cs…
Network Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N . No two places have the same number. The lines are bidirectional and always connect…
最近在学图论相关的内容,阅读这篇博客的前提是你已经基本了解了Tarjan求点双. 由割点的定义(删去这个点就可使这个图不连通)我们可以知道,坍塌的挖煤点只有在割点上才会使这个图不连通,而除了割点的其他点上则无可厚非,所以我们只需要考虑这个图的割点的情况. 那么我们就可以求出所有的点双连通分量, 如果这个点双仅有一个割点,那么这个割点坍塌后这个点双就被"孤立"了,所以需要在这个点双里设置一个救援出口. 那么这个点双如果包含多个割点呢?假设它的其中一个割点坍塌了,它还可以从另外几个割点出去…
题目链接:http://poj.org/problem?id=1523 题意:给出无向图的若干条边,求割点以及各个删掉其中一个割点后将图分为几块. 题目分析:割点用tarjan算法求出来,对于每个割点,dfs一次图,求出有几块不连通的子图. AC代码: #include<cstdio> #include<cstring> +; struct EDGE{ int v,next; }edge[N*N/]; int first[N],low[N],dfn[N],cut[N],vis[N]…
http://poj.org/problem?id=2117 这个妹妹我竟然到现在才见过,我真是太菜了~~~ 求去掉一个点后图中最多有多少个连通块.(原图可以本身就有多个连通块) 首先设点i去掉后它的子树(我知道不准确但是领会精神就好了吧orz)能分成cut[i]个连通块,那么除了根节点之外去掉任意一个点就多出cut[i]个联通块(根节点多出cut[i]-1个连通块). (简洁的语言说cut[i]表示的就是i点是多少个点双连通分量的割顶,我连割顶都忘了是什么了嘤嘤嘤) 每个点只遍历一次且一定在所…
Network Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8797   Accepted: 4116 Description A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N .…