HDU 4739 Zhuge Liang's Mines

题意: 在一个x-y坐标系上有N颗地雷,想要挖出一个地雷只有挖出跟它形成矩形的另外三颗雷才行,问最多可以挖出多少地雷? 解题思路: 记忆化搜索+状态压缩。先把所有雷的坐标按从上到下,从左到右排序,因为最多20颗雷,可以用二进制表示每颗雷的状态。然后DFS记忆化寻找矩形(四重循环确定四个点),找到了...

2016-11-14 09:31:09

阅读数 171

评论数 0


第一种:转换为最大权闭合图的模型来求解: 设max g = f(x)= |E‘|/|V’| ,找一个子图的边数与点数的比值达到其中的最大,我们通常都是构造一个函数max h(g)= |E'|-g*|V'|,当h(g)为0的时候,g的值即为最优,h(g)>0 时 g最优值;因为如果最大值...

2016-10-02 16:33:18

阅读数 279

评论数 0

HDU 3182 Hamburger Magi(状压DP)

In the mysterious forest, there is a group of Magi. Most of them like to eat human beings, so they are called “The Ogre Magi”, but there is an specia...

2016-08-31 12:10:15

阅读数 196

评论数 0

uva 1382 Distant Galaxy(离散化+枚举技巧)

题目: You are observing a distant galaxy using a telescope above the Astronomy Tower, and you think that a rectangle drawn in that galaxy whose edges a...

2016-08-26 09:42:17

阅读数 184

评论数 0

HDU-3635 Dragon Balls

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3635 题目大意: 初始时,有n个龙珠,编号从1到n,分别对应的放在编号从1到n的城市中。 现在又2种操作: T A B,表示把A球所在城市全部的龙珠全部转移到B城市...

2016-08-25 09:57:30

阅读数 164

评论数 0

hdu 3461 Code Lock(并查集+快速幂)

题目: A lock you use has a code system to be opened instead of a key. The lock contains a sequence of wheels. Each wheel has the 26 letters of the E...

2016-08-24 16:34:45

阅读数 158

评论数 0

HDU 4411 费用流,诡异的构图

There are (N+1) cities on TAT island. City 0 is where police headquarter located. The economy of other cities numbered from 1 to N ruined these years...

2016-08-23 21:38:30

阅读数 214

评论数 0


=============================以下是最小生成树+并查集====================================== 【HDU】 1213 How Many Tables 基础并查集★ 1272 小希的迷宫 基础并查集★ 1325&...

2016-08-16 20:33:42

阅读数 537

评论数 0

HDU 3225 Flowers Placement 二分图第k优解

Description Bytetown has a long tradition in organizing an international flower exhibition. Professor Feuerbach, a true flower lover, visited the ex...

2016-08-15 11:15:36

阅读数 216

评论数 0

POJ 3680 Intervals 神奇的构图

Description You are given N weighted open intervals. The ith interval covers (ai, bi) and weighs wi. Your task is to pick some of the intervals ...

2016-08-09 21:35:48

阅读数 184

评论数 0

POJ3686 The Windy's 神奇的拆点

Description The Windy's is a world famous toy factory that owns M top-class workshop to make toys. This year the manager receives N orders for toys...

2016-08-09 21:18:51

阅读数 319

评论数 0

POJ 2987 Firing 最大权闭合图

Description You’ve finally got mad at “the world’s most stupid” employees of yours and decided to do some firings. You’re now simply too mad to ...

2016-08-09 21:06:31

阅读数 262

评论数 0

uva 1151 Buy or Build 状压枚举

题目: 不想给。 题意: 有n个网络站点,q张已经连好的网络子图,每个子图都有一定价格,连接了一些网络站点,最后给出n个点的坐标。 现在想要连接这n个站点,可以买图,也可以自己修路(路的价格是两点距离的平方),求最小价格。 解题思路: 跑一遍不用套餐时的最小生成树,记录下加入生成树的边,然后二进制...

2016-08-07 19:57:53

阅读数 176

评论数 4

POJ 2175 Evacuation Plan 费用流消圈算法

The City has a number of municipal buildings and a number of fallout shelters that were build specially to hide municipal workers in case of a nuclea...

2016-08-07 19:11:05

阅读数 410

评论数 0

POJ 2516 Minimum Cost 最大流的最小费用(不要拆点!)

Description Dearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 ...

2016-08-07 11:21:55

阅读数 214

评论数 0

UVA 11419 SAM I AM 二分图+最小覆盖点

我不想给题目 题意: 给你一张二维图,上面有石头,然后你就用你TN的意大利炮去轰这些石头吧(意大利炮的威力很大,所以能够直线AOE),问你最少打几炮(只能横着或者竖着打)?输出打炮的位置。 解题思路: 题目等价于最多有多少个石头既不在同一行也不再同一列上。有石头的地方行和列就能匹配,找...

2016-08-03 21:18:29

阅读数 222

评论数 0

POJ 3436ACM Computer Factory 最大流+路径输出 dinic模板

As you know, all the computers used for ACM contests must be identical, so the participants compete on equal terms. That is why all these computers a...

2016-08-03 21:02:09

阅读数 476

评论数 0

HDU 3696 SPFA算法

Description “Farm Game” is one of the most popular games in online community. In the community each player has a virtual farm. The farmer can deci...

2016-07-31 11:12:20

阅读数 244

评论数 0

HDU 5222 Exploration 混合图判断是否成环

Description Miceren likes exploration and he found a huge labyrinth underground!  This labyrinth has  caves and some tunnels connecting some pairs...

2016-07-30 20:23:07

阅读数 152

评论数 0

FZU 2039 二分图

Description Are you interested in pets? There is a very famous pets shop in the center of the ACM city. There are totally m pets in the shop, numb...

2016-07-28 20:18:00

阅读数 194

评论数 0

取消 删除