最短路
天涯-沧海
acmer
展开
-
2020 hdu 多校三 1007 Tokitsukaze and Rescue
这题非常暴力,每次枚举最短路上一条边删掉,然后再跑最短路,一直到删完k条边,复杂度极限可以到n^10,不过由于边权值随机,最短路边数不会很大,spfa又比较快,所以就暴力出奇迹了Problem DescriptionPrincess CJB has lived almost her entire life in the isolated town of Ertona, where CJB uses her unique ability to recognize where crystals..原创 2020-07-29 17:56:14 · 256 阅读 · 0 评论 -
(二分答案+最短路)P1462 通往奥格瑞玛的道路
之前智杰问过我一道题:一个图,每条边有两个值x,y,要求在1到n找一条路径,∑x小于给定值a的情况下,∑y的值要最小我当时说要是是x值不超过a,那直接二分答案就好了,没想到今天真碰到这个题意的题了(这道题题意是智杰自己想的,不过我以前做过poj上一道差不多的题poj1724,做法挺暴力的,有兴趣的话可以做做)思路:二分最大经过边的最大值x,边费用小于等于x的边才进行加边,然后跑最短路,如果1到n不连通或减去的血量大于b那不行,反之可以,最后得出的x就是答案了题目背景在艾泽...原创 2020-06-28 23:28:34 · 188 阅读 · 0 评论 -
A - 畅通工程续
某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<M...原创 2019-04-17 20:51:47 · 154 阅读 · 0 评论 -
Til the Cows Come Home
Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get b...原创 2019-04-22 22:23:44 · 80 阅读 · 0 评论 -
Honeycomb
DescriptionA honeycomb is a mass wax cells built by honey bees, which can be described as a regular tiling of the Euclidean plane, in which three hexagons meet at each internal vertex. The internal ...原创 2019-09-22 18:33:03 · 1659 阅读 · 0 评论