![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM_图论
文章平均质量分 82
lethic
这个作者很懒,什么都没留下…
展开
-
Tarjan求割点数量:Network
NetworkTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 6744 Accepted: 3158DescriptionA Telephone Line Company (TLC) is establishing a new telephone cable原创 2012-07-30 20:45:32 · 831 阅读 · 0 评论 -
Bellman-Ford || SPFA :Wormholes
E - WormholesTime Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionWhile exploring his many farms, Farmer John has discovered a number of原创 2012-07-29 16:50:59 · 596 阅读 · 0 评论 -
有向图强连通分量的Tarjan算法
转自点击打开链接[有向图强连通分量]在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected)。如果有向图G的每两个顶点都强连通,称G是一个强连通图。非强连通图有向图的极大强连通子图,称为强连通分量(strongly connected components)。下图中,子图{1,2,3,4}为一个强连通分量,因为顶点1,2,3,4两两可达转载 2012-07-30 10:20:39 · 411 阅读 · 0 评论 -
图的割点、桥与双连通分支
转自 点击打开链接[点连通度与边连通度]在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。一个图的点连通度的定义为,最小割点集合中的顶点数。类似的,如果有一个边集合,删除这个边集合以后,原图变成多个连通块,就称这个点集为割边集合。一个图的边连通度的定义为,最小割边集合中的边数。[双连通图转载 2012-07-30 10:31:49 · 2283 阅读 · 0 评论 -
Tarjan应用:求割点/桥/缩点/强连通分量/双连通分量/LCA(最近公共祖先)
1.割点:若删掉某点后,原连通图分裂为多个子图,则称该点为割点。2.割点集合:在一个无向连通图中,如果有一个顶点集合,删除这个顶点集合,以及这个集合中所有顶点相关联的边以后,原图变成多个连通块,就称这个点集为割点集合。3.点连通度:最小割点集合中的顶点数。4.割边(桥):删掉它之后,图必然会分裂为两个或两个以上的子图。5.割边集合:如果有一个边集合,删除这个边集合以后,原图变成多个转载 2012-07-30 10:35:33 · 4588 阅读 · 0 评论 -
2-SAT的一些小结
///1 2-SAT问题,通俗的说就是有n对点(2n个点),从每对点中选出一个点,共选出n个点,而且要满足若干个这样的条件:某两点不能同时被选出。 设一对点为x、~x,如果a被选出则b一定要被选出,就在图中加有向弧(a,b)表示这种关系。那么如果a,b(a!=b,a!=~b)不能同时被选出,那么加两条有向弧(a,~b),(b,~a)。这样由图的对称性可以证明,2-SAT有解等价于任取转载 2012-07-30 22:40:04 · 3926 阅读 · 0 评论 -
tarjan深搜,缩点: Road Construction
H - Road ConstructionTime Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionIt's almost summer time, and that means that it's almost summer原创 2012-07-30 15:26:08 · 3333 阅读 · 0 评论 -
二维SPFA: As Long As Binbin Loves Sangsang
As long as Binbin loves SangsangTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 753 Accepted Submission(s): 195Problem Description原创 2012-08-15 20:44:12 · 647 阅读 · 0 评论 -
并查集:Forming Teams(CF#133)
Forming Teamstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day n students come to the stadium. They want to play原创 2012-08-15 22:44:58 · 642 阅读 · 0 评论 -
拓扑排序
/* 拓扑排序方法如下: (1)从有向图中选择一个没有前驱(即入度为0)的顶点并且输出它. (2)从网中删去该顶点,并且删去从该顶点发出的全部有向边. (3)重复上述两步,直到剩余的网中不再存在没有前趋的顶点为止.*/bool TopologicalSort(int a[][101]){ //可以完成拓扑排序则返回True int n = a[0][0], i, j;转载 2012-09-30 10:47:12 · 492 阅读 · 0 评论 -
SPFA + 树形DP:The Ghost Blows Light
The Ghost Blows LightTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1017 Accepted Submission(s): 303Problem DescriptionMy name原创 2012-09-15 16:47:00 · 508 阅读 · 0 评论 -
2-sat Katu puzzil
Katu PuzzleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5833 Accepted: 2110DescriptionKatu Puzzle is presented as a directed graph G(V, E) with eac原创 2012-10-16 21:54:44 · 592 阅读 · 0 评论 -
BellmanFord: Til the cows come home
Til the Cows Come HomeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 20995 Accepted: 6994DescriptionBessie is out in the field and wants to get back to t原创 2012-07-27 17:27:54 · 405 阅读 · 0 评论 -
Kruskal: Matrix
MatrixTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 441 Accepted Submission(s): 162Problem DescriptionMachines have once again原创 2012-07-27 11:47:04 · 491 阅读 · 0 评论 -
Kruskal次小生成树 :The Unique MST
The Unique MSTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 14402 Accepted: 4981DescriptionGiven a connected undirected graph, tell if its minimum spann原创 2012-07-28 17:03:19 · 420 阅读 · 0 评论 -
次小生成树
给出一个带边权的无向图G,设其最小生成树为T,求出图G的与T不完全相同的边权和最小的生成树(即G的次小生成树)。一个无向图的两棵生成树不完全相同,当且仅当这两棵树中至少有一条边不同。注意,图G可能不连通,可能有平行边,但一定没有自环(其实对于自环也很好处理:直接舍弃。因为生成树中不可能出现自环)。【具体题目】URAL1416(注意,这一题的边数M的范围没有给出,视为124750)【分析】转载 2012-07-28 13:33:16 · 352 阅读 · 0 评论 -
tarjan变型dfs:Triangle Love
Triangle LOVETime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 69 Accepted Submission(s): 34Problem DescriptionRecently, scientists原创 2012-07-31 19:28:03 · 684 阅读 · 0 评论 -
tarjan 2-sat: party
PartyTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatusDescription有n对夫妻被邀请参加一个聚会,因为场地的问题,每对夫妻中只有1人可以列席。在2n 个人中,某些人之间有着很大的矛盾(当然夫妻之间是没有矛盾的),有矛盾的2个人是不会同时原创 2012-08-06 09:26:49 · 886 阅读 · 0 评论 -
并查集,贪心:Color A Tree
C - Color a TreeTime Limit:1000MS Memory Limit:30000KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionBob is very interested in the data structure of a tree. A tree is a direc原创 2012-07-19 23:26:57 · 3406 阅读 · 0 评论 -
邻接表
#include #include #include #include #include #define MAX 10000using namespace std;int cnt;//输入的位置,即从0开始,输入边的序号int lastshow[MAX];//在输入过程中i上次作为起点时的位置,初始化为-1int sum;int vis[MAX];struct edge原创 2012-07-25 17:08:52 · 340 阅读 · 0 评论 -
Prim: Agri-Net
B - Agri-NetTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFarmer John has been elected mayor of his town! One of his campaign promise原创 2012-07-25 20:06:01 · 448 阅读 · 0 评论 -
Kruscal: Agri-Net
B - Agri-NetTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionFarmer John has been elected mayor of his town! One of his campaign promises原创 2012-07-25 22:04:44 · 491 阅读 · 0 评论 -
SPFA: Power Transmission
Power transmissionTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem DescriptionThe project原创 2012-07-26 16:59:33 · 566 阅读 · 0 评论 -
SPFA:Til the Cows Come Home
D - Til the Cows Come HomeTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionBessie is out in the field and wants to get back to the barn原创 2012-07-27 20:12:44 · 758 阅读 · 0 评论 -
Floyd: Arbitrage
F - ArbitrageTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionArbitrage is the use of discrepancies in currency exchange rates to transf原创 2012-07-29 18:45:10 · 438 阅读 · 0 评论 -
SPFA: Invitation Cards
G - Invitation CardsTime Limit:8000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionIn the age of television, not many people attend theater performance原创 2012-07-29 19:56:58 · 424 阅读 · 0 评论 -
图的重构拓展之最小表示法
字符串最小表示求字符串的循环最小表示: 上面说的两个字符串同构的,并没有直接先求出Min(s),而是通过指针移动,当某次匹配串长时,那个位置就是Min(s)。而这里的问题就是:不是给定两个串,而是给出一个串,求它的Min(s),eg:Min(“babba”) = 4。那么由于这里并非要求两个串的同构,而是直接求它的最小表示,由于源串和目标串相同,所以处理起来既容易又需要有一些变化转载 2012-07-28 10:43:59 · 486 阅读 · 0 评论 -
图的重构:Subway Tree System
Subway tree systemsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5621 Accepted: 2316DescriptionSome major cities have subway systems in the form of a tr原创 2012-07-28 11:40:06 · 539 阅读 · 0 评论 -
Dijkstra: Till the Cows Come Home
D - Til the Cows Come HomeTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmitStatusDescriptionBessie is out in the field and wants to get back to the barn原创 2012-07-26 10:15:21 · 849 阅读 · 0 评论