2013年4月8日

nefu 473 Drainage DitchesHal Burch 最大流

摘要: Drainage DitchesHal BurchTime Limit 1000msMemory Limit 65536KdescriptionEvery time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Thus, Farmer John has built 阅读全文

posted @ 2013-04-08 20:27 电子幼体 阅读(130) 评论(0) 推荐(0) 编辑

Dinic算法求最大流

摘要: #include <iostream> using namespace std; const int OO=1e9;//无穷大 const int maxm=111111;//边的最大数量,为原图的两倍 const int maxn=999;//点的最大数量 int node,src,dest,edge;//node节点数,src源点,dest汇点,edge边数 int head[maxn],work[maxn],dis[maxn],q[maxn];//head链表头,work临时表头,dis计算距离 struct edgenode{ int to;//边的指向 int... 阅读全文

posted @ 2013-04-08 19:21 电子幼体 阅读(166) 评论(0) 推荐(0) 编辑

最大流算法---Ford-Fulkson方法的基本思想与Edmond-Karp算法

摘要: Ford-Fulkson的具体步骤1、初始化网络中所有边的容量,c<u,v>继承该边的容量,c<v,u>初始化为0,其中边<v,u>即为回退边。初始化最大流为0。2、在残留网络中找一条从源S到汇T的增广路p。如能找到,则转步骤3,;如不能找到,则转步骤5。3、在增广路p中找到所谓的"瓶颈"边,即路径中容量最小的边,记录下这个值X,并且累加到最大流中,转步骤4。4、将增广路中所有c<u,v>减去X,所有c<v,u>加上X,构成新的残留网络。转步骤2。5、得到网络的最大流,退出。Edmond-Karp算法用朴素的BFS 阅读全文

posted @ 2013-04-08 18:41 电子幼体 阅读(527) 评论(0) 推荐(0) 编辑

Codeforces 116C. Party 树的深度

摘要: C. Partytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA company hasnemployees numbered from1ton. Each employee either has no immediate manager or exactly one immediate manager, who is another employee with a different number. An employeeAis sai 阅读全文

posted @ 2013-04-08 16:27 电子幼体 阅读(385) 评论(0) 推荐(0) 编辑

Codeforces 278C. Learning Languages 图的遍历

摘要: C. Learning Languagestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe "BerCorp" company has gotnemployees. These employees can usemapproved official languages for the formal correspondence. The languages are numbered with integers fr 阅读全文

posted @ 2013-04-08 16:25 电子幼体 阅读(231) 评论(0) 推荐(0) 编辑

Codeforces 131D. Subway 寻找环-树的最短路径

摘要: D. Subwaytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA subway scheme, classic for all Berland cities is represented by a set ofnstations connected bynpassages, each of which connects exactly two stations and does not pass through any others. 阅读全文

posted @ 2013-04-08 16:22 电子幼体 阅读(267) 评论(0) 推荐(0) 编辑

Codeforces 246D. Colorful Graph

摘要: D. Colorful Graphtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got an undirected graph, consisting ofnvertices andmedges. We will consider the graph's vertices numbered with integers from 1 ton. Each vertex of the graph has a col 阅读全文

posted @ 2013-04-08 16:13 电子幼体 阅读(356) 评论(0) 推荐(0) 编辑

Codeforces 217A. Ice Skating 搜索

摘要: A. Ice Skatingtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBajtek is learning to skate on ice. He's a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he land 阅读全文

posted @ 2013-04-08 16:08 电子幼体 阅读(737) 评论(0) 推荐(0) 编辑

Codeforces 24A. Ring road

摘要: A. Ring roadtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNowadays the one-way traffic is introduced all over the world in order to improve driving safety and reduce traffic jams. The government of Berland decided to keep up with new trends. Fo 阅读全文

posted @ 2013-04-08 15:59 电子幼体 阅读(258) 评论(0) 推荐(0) 编辑

Codeforces 103B. Cthulhu 寻找奈亚子

摘要: B. Cthulhutime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output...Once upon a time a man came to the sea. The sea was stormy and dark. The man started to call for the little mermaid to appear but alas, he only woke up Cthulhu...Whereas on the other en 阅读全文

posted @ 2013-04-08 15:49 电子幼体 阅读(235) 评论(0) 推荐(0) 编辑

Codeforces 263 D. Cycle in Graph 环

摘要: D. Cycle in Graphtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got a undirected graphG, consisting ofnnodes. We will consider the nodes of the graph indexed by integers from 1 ton. We know that each node of graphGis connected by edge 阅读全文

posted @ 2013-04-08 15:46 电子幼体 阅读(326) 评论(0) 推荐(0) 编辑

Codeforces 107A. Dorm Water Supply 搜图

摘要: A. Dorm Water Supplytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe German University in Cairo (GUC) dorm houses are numbered from1ton. Underground water pipes connect these houses together. Each pipe has certain direction (water can flow onl 阅读全文

posted @ 2013-04-08 15:40 电子幼体 阅读(436) 评论(0) 推荐(0) 编辑

Codeforces 34D. Road Map 树的遍历

摘要: D. Road Maptime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere arencities in Berland. Each city has its index — an integer number from1ton. The capital has indexr1. All the roads in Berland are two-way. The road system is such that there is exa 阅读全文

posted @ 2013-04-08 15:34 电子幼体 阅读(366) 评论(0) 推荐(0) 编辑

Codeforces 144D. Missile Silos 最短路

摘要: D. Missile Silostime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA country called Berland consists ofncities, numbered with integer numbers from1ton. Some of them are connected by bidirectional roads. Each road has some length. There is a path fro 阅读全文

posted @ 2013-04-08 15:31 电子幼体 阅读(195) 评论(0) 推荐(0) 编辑

Codeforces 117C. Cycle 寻找环

摘要: C. Cycletime limit per test2.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAtournamentis a directed graph without self-loops in which every pair of vertexes is connected by exactly one directed edge. That is, for any two vertexesuandv(u ≠ v) exists either an edge 阅读全文

posted @ 2013-04-08 15:21 电子幼体 阅读(221) 评论(0) 推荐(0) 编辑

Codeforces 25D. Roads not only in Berland 并查集

摘要: D. Roads not only in Berlandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland Government decided to improve relations with neighboring countries. First of all, it was decided to build new roads so that from each city of Berland and neighbor 阅读全文

posted @ 2013-04-08 15:19 电子幼体 阅读(197) 评论(0) 推荐(0) 编辑

Codeforces 61D. Eternal Victory 树的性质

摘要: D. Eternal Victorytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputValerian was captured by Shapur. The victory was such a great one that Shapur decided to carve a scene of Valerian's defeat on a mountain. So he had to find the best place to m 阅读全文

posted @ 2013-04-08 15:16 电子幼体 阅读(330) 评论(0) 推荐(0) 编辑

Codeforces 28B. pSort 连通性

摘要: B. pSorttime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne dayncells of some array decided to play the following game. Initially each cell contains a number which is equal to it's ordinal number (starting from1). Also each cell determined it 阅读全文

posted @ 2013-04-08 15:10 电子幼体 阅读(396) 评论(0) 推荐(0) 编辑

导航