![](https://img-blog.csdnimg.cn/2019092715111047.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
最短路
lonely_wind_
路漫漫兮
展开
-
牛客练习赛67 E-牛妹游历城市(拆位最短路)
题目链接:https://ac.nowcoder.com/acm/contest/6885/E 博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13507992.html 题目描述 最近,牛妹天天宅在家里,真是憋死人了。他决定出去旅游。 牛妹现在正在1号点(自己家里),他决定前往n号点(牛妹想去的地方),中途可以多次经过1~n号点。 现在,已知每个点都有个权值aia_iai,如果ai&aj≠0a_i \& a_j ≠0ai&aj原创 2020-08-15 11:24:39 · 359 阅读 · 0 评论 -
2020杭电HDU-6832多校第六场A Very Easy Graph Problem(最短路转最小生成树+dfs)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6832 博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13455277.html An undirected connected graph has n nodes and m edges, The i-th edge’s length is 2i2^i2i. Each node i has a value aia_iai, which is either 0 o原创 2020-08-07 21:12:54 · 452 阅读 · 0 评论 -
CodeForces 954D-Fight Against Traffic(加边最短路)
题目链接:https://codeforces.com/problemset/problem/954/D 博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13451829.html Little town Nsk consists of n junctions connected by m bidirectional roads. Each road connects two distinct junctions and no two roads connect原创 2020-08-07 11:43:30 · 596 阅读 · 0 评论 -
CodeForces - 787D.Legacy前向星线段树建图+dij
题目链接https://codeforces.com/contest/787/problem/D time limit per test:2 seconds memory limit per test:256 megabytes Rick and his co-workers have made a new radioactive formula and a lot of bad guys are...原创 2019-10-06 22:29:33 · 334 阅读 · 0 评论 -
Candies POJ-3159--最短路
Time Limit:1500MS Memory Limit:131072K Description During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class ...原创 2019-07-25 10:25:04 · 254 阅读 · 0 评论 -
Sightseeing --HDU-1688&POJ-3463最短路与次短路的条数
Time Limit:2000MS Memory Limit:65536K Description Tour operator Your Personal Holiday organises guided bus trips across the Benelux. Every day the bus moves from one citySto another ...原创 2019-07-24 19:59:29 · 256 阅读 · 0 评论 -
搬砖---离线商旅问题(TSP)--状压DP
Time Limit 998MS Memory Limit 256MB 题目链接http://csustacm.com:4803/problem/1119 Description Input Output 总共输出k行,每行代表lwj完成任务所需要的最短的时间。 Sample Input 1 4 5 3 1 2 3 1 3 2 2 4 2 1 4 4 3 4 1 4 2 2 3 2 1 3...原创 2019-06-06 21:57:52 · 686 阅读 · 0 评论 -
状压DP详解(3)状压DP的路径应用--旅行商问题(TSP)+简单例题POJ3311-Hie with the Pie
旅行商问题:假设有一个旅行商人要拜访n个城市,他必须选择所要走的路径,路径的限制是每个城市只能拜访一次,而且最后要回到原来出发的城市。路径的选择目标是要求得的路径路程为所有路径之中的最小值。 这种题可以用dfs过。。。。也就是搜索所有的可能走法。。。想想总共有n!种方案数,只要n不大一般都ok,只不过需要加剪枝。。。。我的DFS比较菜。。。就只能老老实实写状压DP了。。。 这个状压DP的路径问题有...原创 2019-06-06 18:50:57 · 751 阅读 · 2 评论 -
E.千万别点进来,点进来你就哭了(最短路优化算法)
千万别点进来,点进来你就哭了 Description PY利用寒假摸鱼时间去了一趟香港吃吃吃,下面就由我介绍一下我遇到的好吃的香港美食。 首先介绍第一家合益泰小食,这家主打肠粉,这家的肠粉特别的正宗,价格非常亲民,口感非常好 公和荳品厂,这家的豆腐花特别好吃,超级嫩,口感又香又滑。 添好运——这是一家港式点心店,我推荐吃这里的糯米鸡和凤爪,口感都非常好,这里的虾饺也很好吃。 不过叉烧包太甜了,甜到...原创 2019-03-06 20:41:58 · 416 阅读 · 0 评论 -
G.房间迷宫(优化dj最短路)
房间迷宫 题目链接https://www.cometoj.com/contest/33/problem/G 验证码:jwjtxdy 题目描述 鸡尾酒被困入了一个迷宫! 这个迷宫总共有n个房间组成,鸡尾酒初始在1号房间,n号房间为迷宫的出口。每进入一次第i个房间都需要缴纳ai的过路费(包括初始的一号房间)。每个房间有一张纸条和一个箱子。纸条上写着的数字di代表鸡尾酒下一个可以到达的房间编号。 鸡尾酒...原创 2019-04-05 18:05:33 · 339 阅读 · 0 评论 -
J.是时候表演真正的技术了---优化dijkstra的多起点压缩
是时候表演真正的技术了 Time Limit 1000MS Memory Limit 256MB 题目链接http://csustacm.com:4803/problem/1097 emmm,首先想到的就是暴力。。。直接每个点跑一遍最短路看看它们到哪个宝藏最近。即使经过优化之后也是n2log(n)的复杂的,直接T。 稍微好一点的就是将每个宝藏跑一遍最短路然后每个点取最小值。复杂度还是很高会...原创 2019-05-21 14:23:54 · 355 阅读 · 0 评论