———最短路|生成树
MissZhou要努力
不晓日月,不辩兰艾,终日碌碌,安与燕雀相随乎
展开
-
hdu5294Tricks Device【最短路+网络流】
DescriptionInnocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu’s at the entrance of the tomb while Dumb Zhang’s at the end of it. The tomb is made up of many chambers, the total number原创 2016-04-05 16:37:30 · 736 阅读 · 0 评论 -
hdu1596find the safest road最短路floyd
其实就是模板的加法变成了乘法==但是注意“0”的处理!!看了标程才发现(⊙﹏⊙)b eps涉及double就记得用吧Problem DescriptionXX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2原创 2015-06-16 23:18:53 · 572 阅读 · 0 评论 -
hdu1162Eddy's picture 最小生成树
╮(╯_╰)╭模板是距离已知 这个多算个欧式距离Problem DescriptionEddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draws pictures in his原创 2015-06-16 23:01:32 · 553 阅读 · 0 评论 -
poj2349Arctic Network最小生成树
开始是读错题,其实题意只是要顾及临边,即每次加入到集合的那个数本身,排个序就好了==可是为什么cin 改成scanf就不对==还有就是c++中格式输出的写法== 刚考完就忘了 T^T还好意思嘚瑟自己成绩吗 --->_--->DescriptionThe Department of National Defence (DND) wishes to connect seve原创 2015-06-20 22:58:51 · 855 阅读 · 0 评论 -
hdu4081Qin Shi Huang's National Road System【次小生成树】
今天捡起来好久没碰的图——次小生成树,不难的一个知识点,貌似考的也不多,百度首页除了裸的题就是这个了。说题意:秦始皇统一中国之后要在全国修公路连接各个城市,抠门皇帝只想修成最小生成树(距离最小,不考虑人力),一个道士说自己可以不花人力物力修一条路,经过两方妥协,选择max(两个城市人口/生成树长度-这条路的长度)的路让他变,求这个比值最大值。先说说次小生成树的形成过程,在prim最小生成树原创 2016-02-29 17:03:58 · 707 阅读 · 0 评论 -
HDU 4463 Outlets 最小生成树Kr~
这个题貌似是12年杭州亚洲赛的题==,题意是求一个最小生成树,但是要求有两个已知点必须直接连着==其实挺水的,prim不好实现 改了一晚上。。。还是不知道自己最开始为啥错了=。=DescriptionIn China, foreign brand commodities are often much more expensive than abroad. The原创 2015-07-13 19:00:22 · 663 阅读 · 0 评论 -
poj3311 Hie with the Pie【floyd最短路+状态压缩】
DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast as possible. Unfortunately, due to cutbacks, they can afford to hire only one driver to do the deliveri原创 2016-03-24 20:54:22 · 700 阅读 · 0 评论 -
Hdu 4568 Hunter【spfa最短路 tsp状态压缩】
Description One day, a hunter named James went to a mysterious area to find the treasures. James wanted to research the area and brought all treasures that he could. The area can be represen原创 2016-03-17 17:12:18 · 858 阅读 · 0 评论 -
hdu4966GGS-DDU【最小树形图】 2014多校联合
Problem DescriptionDo you think this is a strange problem name? That is because you don't know its full name---'Good Good Study and Day Day Up!". Very famous sentence! Isn't it?Now "GGS-DDU" is原创 2016-07-01 14:23:07 · 413 阅读 · 0 评论 -
hdu5521Meeting【最短路】2015沈阳现场赛
Problem DescriptionBessie and her friend Elsie decide to have a meeting. However, after Farmer John decorated hisfences they were separated into different blocks. John's farm are divided into n原创 2016-07-26 11:01:25 · 651 阅读 · 0 评论 -
hdu4009Transfer water【最小树形图】
题意:居民点取水,可以自己挖井,可以从别的地方引用,但是有些边不能引用,如果引用的地点海拔高只需要买水管子的钱,引用点海拔低不仅要买泵也要买水管子的钱!!!(这里读错题了)很明显的不定根最小树形图,既然不定根是虚拟出来一个根把它和所有点连起来,最终的结果减去这个边长就可以了,那么不定多根也是一样啊,这题加的虚边权正好是挖井的钱啊。最后就不减去那些边权了啊。所以说,图论的核心还是建边啊原创 2016-07-18 17:43:16 · 383 阅读 · 0 评论 -
uva11183Teen Girl Squad【最小树形图定根模板题】
Problem ITeen Girl Squad Input: Standard InputOutput: Standard OutputTime limit: 3.000 seconds -- 3 spring rolls please.-- MSG'D!!-- Oh! My stomach lining!Str原创 2016-07-18 19:53:15 · 1050 阅读 · 0 评论 -
hdu43700 or 1【01规划模型 最短路】
DescriptionGiven a n*n matrix C ij (1<=i,j<=n),We want to find a n*n matrix Xij (1Besides,X ij meets the following conditions: 1.X 12+X 13+...X 1n=1 2.X 1n+X 2n+...X n-1n=1 3.for eac原创 2016-10-10 19:02:36 · 1567 阅读 · 0 评论 -
poj1062昂贵的聘礼【最短路反向建图】
Description年轻的探险家来到了一个印第安部落里。在那里他和酋长的女儿相爱了,于是便向酋长去求亲。酋长要他用10000个金币作为聘礼才答应把女儿嫁给他。探险家拿不出这么多金币,便请求酋长降低要求。酋长说:"嗯,如果你能够替我弄到大祭司的皮袄,我可以只要8000金币。如果你能够弄来他的水晶球,那么只要5000金币就行了。"探险家就跑到大祭司那里,向他要求皮袄或水晶球,大祭司要他用金币来换原创 2016-03-22 18:48:49 · 688 阅读 · 0 评论 -
51nod1445 变色DNA【最短路】
1445 变色DNA题目来源: TopCoder 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 收藏 取消关注有一只特别的狼,它在每个夜晚会进行变色,研究发现它可以变成N种颜色之一,将这些颜色标号为0,1,2...N-1。研究发现这只狼的基因中存在一个变色矩阵,记为colormap,如果colormap[i][j原创 2016-10-19 12:21:15 · 375 阅读 · 0 评论 -
hdu2680Choose the best route dijkstra
开始呢这个题一看是多个点对点的,想用弗洛伊德做,超时,搜了题解 dijkstra 可以处理多点对一点的 还是没有好好理解dijkstra第一步初始化的作用,第一步从哪个点初始化,就是从哪个点出发==还得是潜下心debug啊~~而且dijkstra中每一步都是最优,完全可以处理多点对一点的问题Problem DescriptionOne day , Kiki wants to visit原创 2015-06-22 14:55:14 · 513 阅读 · 0 评论 -
poj1734Sightseeing trip floyd最小环
就是裸的最小环 链接DescriptionThere is a travel agency in Adelton town on Zanzibar island. It has decided to offer its clients, besides many other attractions, sightseeing the town. To earn as much原创 2015-08-20 19:26:22 · 861 阅读 · 1 评论 -
hdu4786Fibonacci Tree【kruskal最小生成树】
Description Coach Pang is interested in Fibonacci numbers while Uncle Yang wants him to do some research on Spanning Tree. So Coach Pang decides to solve the following problem: Consider a bi原创 2016-04-02 09:58:23 · 662 阅读 · 0 评论 -
uva11478 Halum【二分+差分约束】
You are given a directed graph G(V,E) with a set of vertices and edges. Each edge (i,j) that connects some vertex i to vertex j has an integer cost associated with that edge. Define the operation原创 2016-04-02 09:20:34 · 578 阅读 · 0 评论 -
uva11090Going in Cycle!!【bellman二分判负环】
Problem G: Going in Cycle!!Input: standard inputOutput: standard output You are given a weighted directed graph with n vertices and m edges. Each cycle in the graph has原创 2016-03-29 16:46:51 · 379 阅读 · 0 评论 -
Aizu 2249Road Construction 单源最短路变形 spfa模板改写
DescriptionKing Mercer is the king of ACM kingdom. There are one capital and some cities in his kingdom. Amazingly, there are no roads in the kingdom now. Recently, he planned to construct roads b原创 2016-03-28 21:05:19 · 1061 阅读 · 0 评论 -
hdu5137How Many Maos Does the Guanxi Worth【最短路最大值】
Problem Description"Guanxi" is a very important word in Chinese. It kind of means "relationship" or "contact". Guanxi can be based on friendship, but also can be built on money. So Chinese often say原创 2016-03-22 09:32:03 · 961 阅读 · 0 评论 -
hdu3440House Man【差分约束系统】
Problem DescriptionIn Fuzhou, there is a crazy super man. He can’t fly, but he could jump from housetop to housetop. Today he plans to use N houses to hone his house hopping skills. He will start at原创 2016-03-03 11:06:04 · 1225 阅读 · 0 评论 -
hdu1531King【差分约束系统】
Problem DescriptionOnce, 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 chi原创 2016-03-02 23:09:29 · 1047 阅读 · 0 评论 -
zoj1420Cashier Employment【差分约束系统论文题】
A supermarket in Tehran is open 24 hours a day every day and needs a number of cashiers to fit its need. The supermarket manager has hired you to help him, solve his problem. The problem is that the s原创 2016-03-02 16:26:38 · 1394 阅读 · 2 评论 -
POJ 3159 Candies差分约束系统 spfa 附:各种最短路比较
DescriptionDuring 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 distr原创 2015-08-21 18:54:06 · 632 阅读 · 1 评论 -
POJ 1860 Currency Exchange spfa
DescriptionSeveral currency exchange points are working in our city. Let us suppose that each point specializes in two particular currencies and performs exchange operations only with these curren原创 2015-08-21 16:38:55 · 521 阅读 · 0 评论 -
POJ 2240 Arbitrage floyd
DescriptionArbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar原创 2015-08-21 16:35:10 · 460 阅读 · 0 评论 -
POJ 3268 Silver Cow Party
DescriptionOne cow from each of N farms (1 ≤ N ≤ 1000) conveniently numbered 1..N is going to attend the big cow party to be held at farm #X (1 ≤ X ≤ N). A total of M (1 ≤ M ≤ 100,000) unidirect原创 2015-08-21 16:30:00 · 467 阅读 · 0 评论 -
hdu1599 find the mincost route
Problem Description杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,....VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input原创 2015-08-20 19:30:11 · 496 阅读 · 0 评论 -
P2865 [USACO06NOV]路障Roadblocks【次短路】
370通过1K提交题目提供者FarmerJohn2评测方式云端评测标签USACO2006难度提高+/省选-时空限制1000ms / 128MB【P2865】[USACO06NOV]路障Roadblocks - 洛谷 https://www.luogu.org/problemnew/show/P2865题目描述Bessie has moved to a small farm and sometime...原创 2018-07-11 19:42:25 · 372 阅读 · 3 评论