
图论
文章平均质量分 79
Wiking__acm
这个作者很懒,什么都没留下…
展开
-
hdu 确定比赛名次(拓扑排序)
确定比赛名次Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4 Accepted Submission(s) : 1Font: Times New Roman | Verdana | GeorgiaFont原创 2012-08-02 18:56:17 · 1146 阅读 · 0 评论 -
hdu 畅通工程再续(最小生成树---Kruscal)
畅通工程再续Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 3 Accepted Submission(s) : 2Font: Times New Roman | Verdana | GeorgiaFont原创 2012-08-04 23:56:47 · 1029 阅读 · 0 评论 -
匈牙利算法的理解
过山车Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 2 Accepted Submission(s) : 2Font: Times New Roman | Verdana | GeorgiaFont Siz原创 2012-08-06 11:38:28 · 1022 阅读 · 0 评论 -
hdu 棋盘游戏(最大匹配)
棋盘游戏Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4 Accepted Submission(s) : 2Font: Times New Roman | Verdana | GeorgiaFont Si原创 2012-08-06 17:21:25 · 931 阅读 · 0 评论 -
hdu Uncle Tom's Inherited Land*(最大匹配)
Uncle Tom's Inherited Land*Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 967 Accepted Submission(s): 422Special JudgeProblem De原创 2012-08-08 12:07:10 · 1351 阅读 · 0 评论 -
poj Children of the Candy Corn(Bfs + Dfs)
Children of the Candy CornTime Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 6 Accepted Submission(s) : 6Problem DescriptionThe co原创 2012-08-10 17:07:21 · 2337 阅读 · 0 评论 -
poj Catch That Cow (Bfs)
Catch That CowTime Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 25 Accepted Submission(s) : 9Problem DescriptionFarmer John has原创 2012-08-10 12:02:57 · 1162 阅读 · 0 评论 -
hdu Choose the best route(最短路 --- Dijkstra)
Choose the best routeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4040 Accepted Submission(s): 1260Problem DescriptionOne原创 2012-09-04 14:56:32 · 2429 阅读 · 5 评论 -
hdu Bus System(floyd)
Bus SystemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4239 Accepted Submission(s): 1066Problem DescriptionBecause of the原创 2012-09-05 16:25:22 · 1149 阅读 · 0 评论 -
hdu Minimal Ratio Tree(最小生成树---prim)
Minimal Ratio TreeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1285 Accepted Submission(s): 383Problem DescriptionFor a tr原创 2012-09-05 14:59:07 · 2094 阅读 · 3 评论 -
uva 10047 - The Monocycle(Bfs)
Problem A: The MonocycleA monocycle is a cycle that runs on one wheel and the one we will be considering is a bit more special. It has a solid wheel colored with five different colors as sho原创 2013-03-11 17:31:00 · 1153 阅读 · 0 评论 -
uva 1423 - Guess(拓扑排序)
Given a sequence of integers, a1, a2,...,an , we define its sign matrix S such that, for1ijn , Sij = `` + " if Sij = `` - " if ai +...+aj ; and Sij = ``0" otherwise.For example, if (a1,原创 2013-03-11 21:13:50 · 1580 阅读 · 0 评论 -
uva 11624 - Fire!(Bfs)
Problem B: Fire! Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze.Given Joe'原创 2013-03-11 15:57:43 · 1755 阅读 · 0 评论 -
uva 10917 - Walk Through the Forest(Dijkstra+Dp)
Problem C: A Walk Through the ForestJimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To m原创 2013-03-13 12:55:33 · 1084 阅读 · 0 评论 -
uva 11374 - Airport Express(Dijkstra预处理+枚举)
Problem D: Airport ExpressIn a small city called Iokh, a train service, Airport-Express, takes residents to the airport more quickly than other transports. There are two types of tra原创 2013-03-13 10:39:17 · 3352 阅读 · 0 评论 -
uva 1416 - Warfare And Logistics(dijkstra)
The army of United Nations launched a new wave of air strikes on terrorist forces. The objective of the mission is to reduce enemy's logistical mobility. Each air strike will destroy a path and theref原创 2013-03-14 20:06:20 · 1346 阅读 · 0 评论 -
uva 11367 - Full Tank?(dijkstra TLE)
TLE 啊 TLE,我的想法和讨论版里的是一样的,为什么就是一直TLE呢。是每次查询都重做一遍dijkstra导致的吗?怎么还有人也那样却ac了呢。求大神解释啊。代码啊,恶心的代码啊#include #include #include #include #include //#include using namespace std;const int max原创 2013-03-15 16:58:29 · 1190 阅读 · 0 评论 -
差分约束入门
差分约束这块内容,花了我好几个小时才算真正看懂了。我觉得不是我理解能力差,是网上和书上的资料都没说的很清楚开始时一直不能理解那个d[v]因为我们在求最短路判断时写的是>=后来才明白那个不等式指的是做完最短路后,每个点满足的性质。。。然后下面是两个我觉得比较好的链接,作为查分约束的入门和题集http://zakir.is-programmer.com/posts/21699.原创 2013-03-16 20:22:41 · 993 阅读 · 0 评论 -
uva 10765 - Doves and bombs(割点&BCC)
Problem GDoves and BombsInput: Standard InputOutput: Standard Output Time Limit: 2 SecondsIt is the year 95 ACM (After the Crash of Microsoft). After many years of peace, a war has broken原创 2013-03-30 17:09:20 · 1681 阅读 · 0 评论 -
uva 11419(最大匹配,最小点覆盖)
Problem CSAM I AMInput: Standard InputOutput: Standard Output The world is in great danger!! Mental's forces have returned to Earth to eradicate humankind. Our last hope to stop this great evi原创 2013-03-19 14:32:42 · 2937 阅读 · 0 评论 -
uva 1045 - The Great Wall Game(KM)
Hua and Shen have invented a simple solitaire board game that they call ``The Great Wall Game." The game is played withn stones on ann×n grid. The stones are placed at random in the squares of the g原创 2013-03-18 20:33:13 · 1767 阅读 · 0 评论 -
uva 12168 - Cat vs. Dog (最大匹配 ——最大独立集)
Problem C - Cat vs. DogTime limit: 2 secondsThe latest reality show has hit the TV: ``Cat vs. Dog''. In this show, a bunch of cats and dogs compete for the very prestigiousBest Pet Ever title. I原创 2012-08-08 23:18:52 · 1791 阅读 · 1 评论 -
hdu 3488(uva 1349)(KM)
这道题是uva 1349 的简化版,那题没过,不知道为什么。我觉得那题就是多了一个先判断他最大匹配数是不是n,是的话,再找最优匹配。回到这题,匹配问题,又是有向图,直接想到了拆点法。然后发现若每个点都恰好属于一个环,即是每个点的初度入度都为1,所以只要这个二分图有完美匹配,就是满足题目意思的。这样的话就是找最小匹配了,处理方法,每条边的距离用一个INF值减,最后累加时别忘了再用INF减回来原创 2013-03-20 10:13:32 · 1079 阅读 · 0 评论 -
uva 10972 - RevolC FaeLoN(边双连通分量)
Problem IRevolC FaeLoNHopefully, you can remember Koorosh from one of the previous problems. Fortunately, Koorosh has solved Basm’s problem without your help! Now, he is a high-ranked advisor of B原创 2013-04-03 18:16:10 · 1424 阅读 · 0 评论 -
uva 11396 - Claw Decomposition(二分图判定)
Problem BClaw DecompositionInput: Standard InputOutput: Standard Output A claw is defined as a pointed curved nail on the end of each toe in birds, some reptiles, and some mammals. However, if原创 2013-03-30 12:47:22 · 2283 阅读 · 2 评论 -
uva 11324 - The Largest Clique(缩点 + dp)
Problem B: The Largest CliqueGiven a directed graph G, consider the following transformation. First, create a new graphT(G) to have the same vertex set as G. Create a directed edge between two v原创 2013-04-07 10:14:01 · 1512 阅读 · 0 评论 -
KM算法模版(LRJ)
#include #include #include using namespace std;const int maxn = 500 + 10;const int INF = 1000000000;int W[maxn][maxn], n;int Lx[maxn], Ly[maxn]; // 顶标int left[maxn]; // lef原创 2013-03-18 15:12:14 · 1179 阅读 · 0 评论 -
la 3989(稳定婚姻问题)
感觉这个问题还是蛮有趣的,照着书上敲了一遍,时间复杂度O(n2)。留存作模版#include #include using namespace std;const int maxn = 1000 + 10;int pref[maxn][maxn],order[maxn][maxn],next[maxn];int future_husband[maxn],future_w原创 2013-03-18 14:00:09 · 1264 阅读 · 0 评论 -
最大流Dinic模版(LRJ)
#include#include#include#include#includeusing namespace std;const int maxn = 100 + 10;const int INF = 1000000000;struct Edge { int from, to, cap, flow;};struct Dinic {原创 2013-03-23 14:33:51 · 899 阅读 · 0 评论 -
最小费用最大流模版(LRJ)
#include#include#include#include#includeusing namespace std;const int maxn = 202 + 10;const int INF = 1000000000;struct Edge { int from, to, cap, flow, cost;};struct MCMF原创 2013-03-23 21:04:13 · 1131 阅读 · 0 评论 -
“次小生成树类问题”模版
#include#include#include#include#includeusing namespace std;const int maxn = 1000 + 10;struct Edge { int x, y; double d; bool operator < (const Edge& rhs) const { retur原创 2013-03-27 09:46:40 · 807 阅读 · 0 评论 -
无向图点双连同分量BCC模版(LRJ)
#include#include#include#include#includeusing namespace std;const int maxn = 1000 + 10;struct Edge { int u, v; };int pre[maxn], iscut[maxn], bccno[maxn], dfs_clock, bcc_cnt; // 割原创 2013-03-30 17:16:09 · 1078 阅读 · 0 评论 -
强连通分量SCC模版(LRJ)
#include#include#include#include#includeusing namespace std;const int maxn = 1000 + 10;//图中节点编号从0开始,scc从1开始vector G[maxn];int pre[maxn], lowlink[maxn], sccno[maxn], dfs_clock, scc_原创 2013-04-07 09:26:42 · 1137 阅读 · 0 评论 -
最大匹配BPM模版(LRJ)
const int maxn = 500 + 5; // 单侧顶点的最大数目// 二分图最大基数匹配,邻接矩阵写法struct BPM { int n, m; // 左右顶点个数 int G[maxn][maxn]; // 邻接表 int left[maxn]; // left[i]为右边第i个点的匹配点编号,-1原创 2013-03-19 13:02:37 · 1004 阅读 · 0 评论 -
uva 11294 - Wedding(TwoSAT)
Problem E: WeddingUp to thirty couples will attend a wedding feast, at which they will be seated on either side of a long table. The bride and groom sit at one end, opposite each other, and the brid原创 2013-04-06 18:21:11 · 1721 阅读 · 0 评论 -
uva 1086 - The Ministers' Major Mess(TwoSat)
csdn真是神坑,刚写的解题竟然被吞了,尼玛,害我重写。本题的突破口在每个投票人都要有超过一半的建议被采纳。所以对于k=3的,只有一个建议不能采纳。都得采纳的,我用了一个must数组记录,然后dfs找出所有开始就定下来的建议的值;只有一个不能采纳,即每两个建议间都至少有一个被采纳。最后输出要判断“?”,我的方法是对每个建议检查是否无论它采不采纳都有解。开始忘了dfs找所有应该must的原创 2013-04-06 21:24:05 · 1472 阅读 · 0 评论 -
uva 11613 - Acme Corporation(最小费用流)
Problem IAcme CorporationInput: Standard InputOutput: Standard Output Wile E. Coyote is back. He is back in the business. The business of capturing the road runner. Being the most loyal custom原创 2013-03-23 20:55:58 · 1692 阅读 · 0 评论 -
uva 12125 - March of the Penguins(最大流)
Problem B - March of the PenguinsTime limit: 4 secondsSomewhere near the south pole, a number of penguins are standing on a number of ice floes. Being social animals, the penguins would like to ge原创 2013-03-24 16:43:26 · 2003 阅读 · 0 评论 -
二分图最小点覆盖模版(LRJ)
#include #include #include #include using namespace std;const int maxn = 1000 + 5; // 单侧顶点的最大数目// 二分图最大基数匹配struct BPM { int n, m; // 左右顶点个数 vector G[maxn]; //原创 2013-03-19 13:19:24 · 1339 阅读 · 0 评论 -
uva 1317 - Concert Hall Scheduling(最小费用最大流)
You are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director原创 2013-03-24 12:21:06 · 1595 阅读 · 0 评论