
图论
文章平均质量分 53
Tizzii
这个作者很懒,什么都没留下…
展开
-
URAL - 1099 Work Scheduling一般图最大匹配-带花树
一、内容There is a certain amount of night guards that are available to protect the local junkyard from possible junk robberies. These guards need to be scheduled in pairs so that each pair guards in a d...原创 2020-02-28 21:10:28 · 415 阅读 · 0 评论 -
HDU 3488 Tour KM完美匹配
一、内容 In the kingdom of Henryy, there are N (2 <= N <= 200) cities, with M (M <= 30000) one-way roads connecting them. You are lucky enough to have a chance to have a tour in the kingdom. The...原创 2020-02-28 20:01:55 · 529 阅读 · 0 评论 -
HDU 2255 奔小康赚大钱 KM算法
一、内容 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。这可是一件大事,关系到人民的住房问题啊。村里共有n间房间,刚好有n家老百姓,考虑到每家都要有房住(如果有老百姓没房子住的话,容易引起不安定因素),每家必须分配到一间房子且只能得到一间房子。另一方面,村长和另外的村领导希望得到最大的效益,这样村里的机构才会有钱.由于老百姓都比较富裕,他们都能对每一间房子...原创 2020-02-28 18:57:51 · 366 阅读 · 0 评论 -
POJ 3189 Steady Cow Assignment 二分+枚举+多重匹配
一、内容Farmer John's N (1 <= N <= 1000) cows each reside in one of B (1 <= B <= 20) barns which, of course, have limited capacity. Some cows really like their current barn, and some are not ...原创 2020-02-27 20:53:10 · 530 阅读 · 1 评论 -
POJ 2112 Optimal Milking 二分 + 多重匹配 +Floyd
一、内容FJ has moved his K (1 <= K <= 30) milking machines out into the cow pastures among the C (1 <= C <= 200) cows. A set of paths of various lengths runs among the cows and the milking ma...原创 2020-02-27 19:50:16 · 492 阅读 · 0 评论 -
POJ 2289 Jamie's Contact Groups 多重匹配+二分
一、内容Jamie is a very popular girl and has quite a lot of friends, so she always keeps a very long contact list in her cell phone. The contact list has become so long that it often takes a long time fo...原创 2020-02-27 17:59:51 · 1624 阅读 · 0 评论 -
HDU 3829 Cat VS Dog 最大独立集
一、内容 The zoo have N cats and M dogs, today there are P children visiting the zoo, each child has a like-animal and a dislike-animal, if the child's like-animal is a cat, then his/hers dislike-animal ...原创 2020-02-27 16:28:25 · 599 阅读 · 0 评论 -
POJ 2594 Treasure Exploration 最小路径重复点覆盖
一、内容Have you ever read any book about treasure exploration? Have you ever see any film about treasure exploration? Have you ever explored treasure? If you never have such experiences, you would never...原创 2020-02-27 15:27:19 · 537 阅读 · 0 评论 -
HDU 1151Air Raid 最小路径重复点覆盖
一、内容 Consider a town where all the streets are one-way and each street leads from one intersection to another. It is also known that starting from an intersection and walking through town's streets y...原创 2020-02-26 17:58:33 · 548 阅读 · 0 评论 -
HDU - 1054 Strategic Game 最小点覆盖
一、内容 Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast enough and then he is very sad. Now he has the following problem. He must defend a m...原创 2020-02-26 17:39:53 · 443 阅读 · 0 评论 -
POJ 3020 Antenna Placement 最小路径点覆盖
一、内容The Global Aerial Research Centre has been allotted the task of building the fifth generation of mobile phone nets in Sweden. The most striking reason why they got the job, is their discovery of ...原创 2020-02-26 17:25:02 · 582 阅读 · 0 评论 -
HDU - 4185 Oil Skimming
一、内容 Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped u...原创 2020-02-25 20:22:59 · 632 阅读 · 0 评论 -
USACO 骑马修栅栏 欧拉回路
一、内容农民John每年有很多栅栏要修理。他总是骑着马穿过每一个栅栏并修复它破损的地方。John是一个与其他农民一样懒的人。他讨厌骑马,因此从来不两次经过一个栅栏。你必须编一个程序,读入栅栏网络的描述,并计算出一条修栅栏的路径,使每个栅栏都恰好被经过一次。John能从任何一个顶点(即两个栅栏的交点)开始骑马,在任意一个顶点结束。每一个栅栏连接两个顶点,顶点用 1到 500 标号(虽然有的农场...原创 2020-02-18 11:36:41 · 399 阅读 · 0 评论 -
P1983 车站分级 拓扑序 + 虚拟点
一、内容题目描述一条单向的铁路线上,依次有编号为 1,2,…,n1, 2, …, n 1,2,…,n的 nn n个火车站。每个火车站都有一个级别,最低为 111 级。现有若干趟车次在这条线路上行驶,每一趟都满足如下要求:如果这趟车次停靠了火车站 xxx,则始发站、终点站之间所有级别大于等于火车站x xx 的都必须停靠。(注意:起始站和终点站自然也算作事先已知需要停靠的站点)例如,下表是5 ...原创 2020-02-17 16:41:44 · 454 阅读 · 0 评论 -
BZOJ 2730 矿场搭建 割点
一、内容矿工地可以看成是由隧道连接挖煤点组成的无向图。为安全起见,希望在工地发生事故时所有挖煤点的工人都能有一条出路逃到救援出口处。于是矿主决定在某些挖煤点设立救援出口,使得无论哪一个挖煤点坍塌之后,其他挖煤点的工人都有一条道路通向救援出口。请写一个程序,用来计算至少需要设置几个救援出口,以及不同最少救援出口的设置方案总数。 Input输入文件有若干组数据,每组数据的第一行是一个正整数 N...原创 2020-02-14 15:48:55 · 379 阅读 · 0 评论 -
POJ 3177 Redundant Paths e-DCC缩点
一、内容In order to get from one of the F (1 <= F <= 5,000) grazing fields (which are numbered 1..F) to another field, Bessie and the rest of the herd are forced to cross near the Tree of Rotten Ap...原创 2020-02-13 16:11:54 · 537 阅读 · 0 评论 -
BZOJ 2330 银河 SCC + 差分约束
一、内容银河中的恒星浩如烟海,但是我们只关注那些最亮的恒星。我们用一个正整数来表示恒星的亮度,数值越大则恒星就越亮,恒星的亮度最暗是 1。现在对于 N 颗我们关注的恒星,有 M 对亮度之间的相对关系已经判明。你的任务就是求出这 N 颗恒星的亮度值总和至少有多大。输入格式第一行给出两个整数 N 和 M。之后 M 行,每行三个整数 T, A, B,表示一对恒星(A, B)之间的...原创 2020-02-13 13:31:31 · 642 阅读 · 0 评论 -
BZOJ 1093 最大半连通子图 SCC + DP
一、内容 一个有向图G=(V,E)称为半连通的(Semi-Connected),如果满足:?u,v∈V,满足u→v或v→u,即对于图中任意两点u,v,存在一条u到v的有向路径或者从v到u的有向路径。若G'=(V',E')满足V'?V,E'是E中所有跟V'有关的边,则称G'是G的一个导出子图。若G'是G的导出子图,且G'半连通,则称G'为G的半连通子图。若G'是G所有半连通子图中包含节点数最...原创 2020-02-12 21:54:14 · 453 阅读 · 0 评论 -
POJ 1236 Network of Schools SCC
一、内容A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receivi...原创 2020-02-12 20:19:46 · 658 阅读 · 0 评论 -
BZOJ 1051 受欢迎的牛
一、内容 每一头牛的愿望就是变成一头最受欢迎的牛。现在有N头牛,给你M对整数(A,B),表示牛A认为牛B受欢迎。 这种关系是具有传递性的,如果A认为B受欢迎,B认为C受欢迎,那么牛A也认为牛C受欢迎。你的任务是求出有多少头牛被所有的牛认为是受欢迎的。 Input 第一行两个数N,M。 接下来M行,每行两个数A,B,意思是A认为B是受欢迎的(给出的信息有可能重复,即有可能出现多个A,...原创 2020-02-12 19:03:08 · 365 阅读 · 0 评论 -
P1600 NOIP2016 天天爱跑步 LCA + 树上差分
一、内容题目描述小c 同学认为跑步非常有趣,于是决定制作一款叫做《天天爱跑步》的游戏。《天天爱跑步》是一个养成类游戏,需要玩家每天按时上线,完成打卡任务。这个游戏的地图可以看作一一棵包含 nnn 个结点和 n−1n-1n−1 条边的树,每条边连接两个结点,且任意两个结点存在一条路径互相可达。树上结点编号为从 111 到 nnn 的连续正整数。现在有 mmm 个玩家,第 iii 个玩家的...原创 2020-02-12 16:26:05 · 1017 阅读 · 0 评论 -
P4556 雨天的尾巴 线段树合并
一、内容题目背景深绘里一直很讨厌雨天。灼热的天气穿透了前半个夏天,后来一场大雨和随之而来的洪水,浇灭了一切。虽然深绘里家乡的小村落对洪水有着顽固的抵抗力,但也倒了几座老房子,几棵老树被连根拔起,以及田地里的粮食被弄得一片狼藉。无奈的深绘里和村民们只好等待救济粮来维生。不过救济粮的发放方式很特别。题目描述首先村落里的一共有 nnn 座房屋,并形成一个树状结构。然后救济粮分 ...原创 2020-02-11 21:49:51 · 535 阅读 · 3 评论 -
POJ 3417 Network 树上差分
一、内容Yixght is a manager of the company called SzqNetwork(SN). Now she's very worried because she has just received a bad news which denotes that DxtNetwork(DN), the SN's business rival, intents to at...原创 2020-02-11 17:54:43 · 632 阅读 · 0 评论 -
BZOJ 1977 次小生成树 Tree
一、内容小 C 最近学了很多最小生成树的算法,Prim 算法、Kurskal 算法、消圈算法等等。 正当小 C 洋洋得意之时,小 P 又来泼小 C 冷水了。小 P 说,让小 C 求出一个无向图的次小生成树,而且这个次小生成树还得是严格次小的,也就是说: 如果最小生成树选择的边集是 EM,严格次小生成树选择的边集是 ES,那么需要满足:(value(e) 表示边 e的权值) 这下小 C 蒙了,他找...原创 2020-02-11 16:10:39 · 515 阅读 · 0 评论 -
HDU 2586 How far away ? LCA
一、内容 There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want to go from house A to house B"? Usually it h...原创 2020-02-10 16:55:25 · 703 阅读 · 1 评论 -
LCA 最近公共祖先 详解
一、内容给定一棵包含 n 个节点的有根无向树,节点编号互不相同,但不一定是 1∼n。有 m 个询问,每个询问给出了一对节点的编号 x 和 y,询问 x 与 y 的祖孙关系。输入格式输入第一行包括一个整数 表示节点个数;接下来 n 行每行一对整数 a 和 b,表示 a 和 b 之间有一条无向边。如果 b 是 −1,那么 a 就是树的根;第 n+2 行是一个整数 m 表示询问个数;...原创 2020-02-10 16:13:51 · 642 阅读 · 0 评论 -
HDU 1875 畅通工程再续
一、内容 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实...原创 2020-02-10 14:26:27 · 458 阅读 · 0 评论 -
POJ 1679 The Unique MST
一、内容Given a connected undirected graph, tell if its minimum spanning tree is unique.Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G is a subgra...原创 2020-02-09 21:30:43 · 670 阅读 · 0 评论 -
POJ 3026 Borg Maze P 最小生成树
一、内容The Borg is an immensely powerful race of enhanced humanoids from the delta quadrant of the galaxy. The Borg collective is the term used to describe the group consciousness of the Borg civilizati...原创 2020-02-09 20:40:11 · 827 阅读 · 0 评论 -
POJ 3255 Roadblocks 次短路
一、内容Bessie has moved to a small farm and sometimes enjoys returning to visit one of her best friends. She does not want to get to her old home too quickly, because she likes the scenery along the way...原创 2020-02-09 17:48:27 · 1863 阅读 · 0 评论 -
ZOJ - 1586 QS Network 最小生成树
一、内容In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QScommunicate with each other via networks. If two QS want to get connected, they need to buy two network adap...原创 2020-02-09 11:24:31 · 1472 阅读 · 0 评论 -
POJ 2421 Constructing Roads
一、内容There are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect to each other. We say two village A and B are connected, if and only...原创 2020-02-09 11:05:15 · 501 阅读 · 0 评论 -
USACO 秘密的牛奶运输 次小生成树
一、内容秘密的牛奶运输农夫约翰要把他的牛奶运输到各个销售点。运输过程中,可以先把牛奶运输到一些销售点,再由这些销售点分别运输到其他销售点。运输的总距离越小,运输的成本也就越低。低成本的运输是农夫约翰所希望的。不过,他并不想让他的竞争对手知道他具体的运输方案,所以他希望采用费用第二小的运输方案而不是最小的。现在请你帮忙找到该运输方案。注意::如果两个方案至少有一条边...原创 2020-02-08 20:33:40 · 1821 阅读 · 2 评论 -
走廊泼水节 最小生成树
一、内容描述【简化版题意】给定一棵N个节点的树,要求增加若干条边,把这棵树扩充为完全图,并满足图的唯一最小生成树仍然是这棵树。求增加的边的权值总和最小是多少。我们一共有N个OIER打算参加这个泼水节,同时很凑巧的是正好有N个水龙头(至于为什么,我不解释)。N个水龙头之间正好有N-1条小道,并且每个水龙头都可以经过小道到达其他水龙头(这是一棵树,你应该懂的..)。但是OIER门为了迎接中中的...原创 2020-02-08 16:28:23 · 558 阅读 · 1 评论 -
POJ 2349 Arctic Network 最小生成树
一、内容The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: ev...原创 2020-02-08 15:24:08 · 610 阅读 · 0 评论 -
信息学 新的开始 最小生成树
一、内容题目描述Farmer John has decided to bring water to his N (1 <= N <= 300) pastures which are conveniently numbered 1..N. He may bring water to a pasture either by building a well in that pasture...原创 2020-02-08 10:07:31 · 414 阅读 · 0 评论 -
POJ 3169 Layout 差分约束
一、内容Like 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 ...原创 2020-02-07 22:32:37 · 649 阅读 · 0 评论 -
HDU 4370 0 or 1 最短路 + 思维
一、内容 Given a n*n matrix C ij (1<=i,j<=n),We want to find a n*n matrix X ij (1<=i,j<=n),which is 0 or 1.Besides,X ij meets the following conditions:1.X 12+X 13+...X 1n=12.X 1n+X 2n+.....原创 2020-02-07 22:10:55 · 855 阅读 · 1 评论 -
HDU3416 Marriage Match IV 最短路 + 最大流
一、内容 Do not sincere non-interference。Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A and girls are in city B. Every time starvae ca...原创 2020-02-07 17:42:41 · 580 阅读 · 0 评论 -
最大流模板 Dinic
一、内容题目描述如题,给出一个网络图,以及其源点和汇点,求出其网络最大流。输入格式 第一行包含四个正整数N、M、S、T,分别表示点的个数、有向边的个数、源点序号、汇点序号。接下来M行每行包含三个正整数ui、vi、wi,表示第i条有向边从ui出发,到达vi,边权为wi(即该边最大流量为wi)输出格式一行,包含一个正整数,即为该网络的最大流。输入 #14 5 4 34 2 ...原创 2020-02-07 15:37:50 · 425 阅读 · 0 评论