随笔分类 - 网络流
摘要:Frogs' NeighborhoodTime Limit:5000MSMemory Limit:10000KTotal Submissions:5819Accepted:2498Special JudgeDescription未名湖附近共有N个大小湖泊L1,L2, ...,Ln(其中包括未名湖),每个湖泊Li里住着一只青蛙Fi(1 ≤i≤N)。如果湖泊Li和Lj之间有水路相连,则青蛙Fi和Fj互称为邻居。现在已知每只青蛙的邻居数目x1,x2, ...,xn,请你给出每两个湖泊之间的相连关系。Input第一行是测试数据的组数T(0 ≤T≤ 20)。每组数据包括两行,第一行是整数N(2
阅读全文
摘要:Full Tank?Time Limit:1000MSMemory Limit:65536KTotal Submissions:5619Accepted:1836DescriptionAfter going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some money if you were a bit
阅读全文
摘要:Sightseeing CowsTime Limit:1000MSMemory Limit:65536KTotal Submissions:6684Accepted:2196DescriptionFarmer John has decided to reward his cows for their hard work by taking them on a tour of the big city! The cows must decide how best to spend their free time.Fortunately, they have a detailed city map
阅读全文
摘要:Closest Common AncestorsTime Limit:2000MSMemory Limit:10000KTotal Submissions:12745Accepted:4162DescriptionWrite a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the closest common ancestor of u and v in the tree. The closest com
阅读全文
摘要:Nearest Common AncestorsTime Limit:1000MSMemory Limit:10000KTotal Submissions:13981Accepted:7454DescriptionA rooted tree is a well-known data structure in computer science and engineering. An example is shown below:In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8 is the
阅读全文
摘要:IntervalsTime Limit:2000MSMemory Limit:65536KTotal Submissions:18740Accepted:7042DescriptionYou are given n closed, integer intervals [ai, bi] and n integers c1, ..., cn.Write a program that:reads the number of intervals, their end points and integers c1, ..., cn from the standard input,computes the
阅读全文
摘要:网络流题目集锦(转)最大流POJ 1273 Drainage DitchesPOJ 1274 The Perfect Stall (二分图匹配)POJ 1698 Alice's ChancePOJ 1459 Power NetworkPOJ 2112 Optimal Milking (二分)POJ 2455 Secret Milking Machine (二分)POJ 3189 Steady Cow Assignment (枚举)POJ 1637 Sightseeing tour (混合图欧拉回路)POJ 3498 March of the Penguins (枚举汇点)POJ 108
阅读全文
摘要:CandiesTime Limit:1500MSMemory Limit:131072KTotal Submissions:19891Accepted:5241DescriptionDuring the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the kids lov
阅读全文
摘要:LayoutTime Limit:1000MSMemory Limit:65536KTotal Submissions:5190Accepted:2491DescriptionLike everyone else, cows like to stand close to their friends when queuing for feed. FJ has N (2 <= N <= 1,000) cows numbered 1..N standing along a straight line waiting for feed. The cows are standing in t
阅读全文
摘要:找了好久终于在这个牛这里找到为什么反向边要加回流量的原因了,因为是初学教程,所以我会尽量避免繁杂的数学公式和证明。也尽量给出了较为完整的代码。本文的目标群体是网络流的初学者,尤其是看了各种NB的教程也没看懂怎么求最大流的小盆友们。本文的目的是,解释基本的网络流模型,最基础的最大流求法,即bfs找增广路法,也就是EK法,全名是Edmond-Karp,其实我倒是觉得记一下算法的全名和来历可以不时的拿出来装一装。 比如说这个,EK算法首先由俄罗斯科学家Dinic在1970年提出,没错,就是dinic算法的创始人,实际上他提出的也正是dinic算法,在EK的基础上加入了层次优化,这个我们以后再说,19
阅读全文
摘要:KingTime Limit:1000MSMemory Limit:10000KTotal Submissions:8534Accepted:3221DescriptionOnce, in one kingdom, there was a queen and that queen was expecting a baby. The queen prayed: ``If my child was a son and if only he was a sound king.'' After nine months her child was born, and indeed, sh
阅读全文
摘要:Flow ProblemTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 4865Accepted Submission(s): 2275Problem DescriptionNetwork flow is a well-known difficult problem for ACMers. Given a graph, your task is to find out the maximum flow for the weighted dire
阅读全文
摘要:Minimum CutTime Limit:10000MSMemory Limit:65536KTotal Submissions:6403Accepted:2663Case Time Limit:5000MSDescriptionGiven an undirected graph, in which two vertices can be connected by multiple edges, what is the size of the minimum cut of the graph? i.e. how many edges must be removed at least to d
阅读全文
摘要:Dual Core CPUTime Limit:15000MSMemory Limit:131072KTotal Submissions:15782Accepted:6813Case Time Limit:5000MSDescriptionAs more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, decided to update their famous product - SWODNIW.The ro
阅读全文
摘要:奔小康赚大钱Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1836Accepted Submission(s): 798Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另
阅读全文
摘要:Popular CowsTime Limit:2000MSMemory Limit:65536KTotal Submissions:19083Accepted:7675DescriptionEvery cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M <= 50,000) ordered pairs of the form (A, B) that tell
阅读全文
摘要:Intelligence SystemTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 901Accepted Submission(s): 401Problem DescriptionAfter a day, ALPCs finally complete their ultimate intelligence system, the purpose of it is of course for ACM ... ...Now, kzc_tc, t
阅读全文
摘要:Father Christmas flymouseTime Limit:1000MSMemory Limit:131072KTotal Submissions:1999Accepted:674DescriptionAfter retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ends such as cleaning out the computer lab for training as extension of his contribution to the team. W
阅读全文
摘要:Going from u to v or from v to u?Time Limit:2000MSMemory Limit:65536KTotal Submissions:12260Accepted:3139DescriptionIn order to make their sons brave, Jiajia and Wind take them to a big cave. The cave has n rooms, and one-way corridors connecting some rooms. Each time, Wind choose two rooms x and y,
阅读全文
摘要:1.定义:割点:某个点是割点当且仅当删除该点和与该点相关联的边后图变得不连通。桥(割边):某条边是割边当且仅当删除该边后图变的不连通。双连通分支:图G的所有子图G'中,如果G'是连通的,则称G'是双连通子图。如果G'不是任何一个连通子图的真子图,那么图G'是双连通分支。特别的,点双连通分支又叫做块。2.求割点,桥对原图进行深度优先搜索,会生成一颗深度优先搜索生成树。定义dfs[u]为u在深度优先搜索生成树中被遍历到的序号,low[u]为u或者他的子树中可以通过非父子边追溯到的最早结点。那么一个顶点是割点,满足下列条件之一:1).u是树根,u有两个或两个以
阅读全文

浙公网安备 33010602011771号