最短路&&最小生成树
文章平均质量分 73
elbadaernu
这个作者很懒,什么都没留下…
展开
-
poj 1511 Invitation Cards(优先队列优化Dijkstra+链式前向星存储边)
DescriptionIn the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comed原创 2017-05-02 21:27:30 · 840 阅读 · 0 评论 -
poj 3660 Cow Contest(传递闭包floyed算法)
DescriptionN (1 ≤ N ≤ 100) cows, conveniently numbered 1..N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating原创 2017-04-27 15:44:03 · 365 阅读 · 0 评论 -
codevs 1519 过路费(最小生成树Kruskal算法+lca)
题目描述 Description 在某个遥远的国家里,有 n个城市。编号为 1,2,3,…,n。这个国家的政府修建了m 条双向道路,每条道路连接着两个城市。政府规定从城市 S 到城市T需要收取的过路费为所经过城市之间道路长度的最大值。如:A到B长度为 2,B到C 长度为3,那么开车从 A经过 B到C 需要上交的过路费为 3。 佳佳是个做生意的人,需要经常开车从任意一个城市到另外一原创 2017-05-18 20:47:15 · 835 阅读 · 0 评论 -
codevs 3287货车运输 (最大生成树+lca)
题目描述 Description A 国有 n 座城市,编号从 1 到 n,城市之间有 m 条双向道路。每一条道路对车辆都有重量限制,简称限重。现在有 q 辆货车在运输货物,司机们想知道每辆车在不超过车辆限重的情况下,最多能运多重的货物。输入描述 Input Description 第一行有两个用一个空格隔开的整数 n,m,表示 A 国有 n 座城市和 m 条道路。 接下来 m 行每行 3 个原创 2017-05-18 22:13:55 · 384 阅读 · 0 评论 -
HDU 2586 How far away ?(lca)
Problem Description 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”原创 2017-05-17 12:55:34 · 364 阅读 · 0 评论 -
codevs 1183 泥泞的道路 (spfa +二分)
题目描述 Description CS有n个小区,并且任意小区之间都有两条单向道路(a到b,b到a)相连。因为最近下了很多暴雨,很多道路都被淹了,不同的道路泥泞程度不同。小A经过对近期天气和地形的科学分析,绘出了每条道路能顺利通过的时间以及这条路的长度。现在小A在小区1,他希望能够很顺利地到达目的地小区n,请帮助小明找出一条从小区1出发到达小区n的所有路线中(总路程/总时间)最大的路线。请你告诉原创 2017-05-30 21:45:41 · 311 阅读 · 0 评论 -
2017"百度之星"程序设计大赛 - 初赛(B)1002 Factory (lca+暴力)
Time Limit: 20000/10000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)Problem Description 我们将A省简化为由N个城市组成,某些城市之间存在双向道路,而且A省的交通有一个特点就是任意两个城市之间都能通过道路相互到达,且在不重复经过城市的情况下任意两个城市之间的到达方案都是唯一的。原创 2017-08-15 22:06:39 · 655 阅读 · 0 评论 -
find the safest road HDU - 1596 (spfa)
Problem Description XX星球有很多城市,每个城市之间有一条或多条飞行通道,但是并不是所有的路都是很安全的,每一条路有一个安全系数s,s是在 0 和 1 间的实数(包括0,1),一条从u 到 v 的通道P 的安全度为Safe(P) = s(e1)*s(e2)…*s(ek) e1,e2,ek是P 上的边 ,现在8600 想出去旅游,面对这这么多的路,他想找一条最安全的路。但是860原创 2017-08-26 16:42:35 · 227 阅读 · 0 评论 -
Slim Span POJ - 3522 (最小生成树)
Given an undirected weighted graph G, you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E), where V is a set of vertices {v1, v2, …, vn} and E is a set of un原创 2017-08-26 23:40:06 · 341 阅读 · 0 评论 -
In Touch HDU - 5361 (Dijkstra+并查集)
Problem Description There are n soda living in a straight line. soda are numbered by 1,2,…,n from left to right. The distance between two adjacent soda is 1 meter. Every soda has a teleporter. The tel原创 2017-08-27 12:12:52 · 256 阅读 · 0 评论 -
hdu 5723 Abandoned country(最小生成树)
Problem Description An abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads to be re-原创 2017-05-09 21:04:10 · 299 阅读 · 0 评论 -
poj 1860 Currency Exchange (spfa或Bellman-Ford)
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 currencies.原创 2017-04-26 21:33:45 · 334 阅读 · 0 评论 -
poj 3159 Candies (差分约束 先队列优化Dijkstra 链式前向星存储)
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 distribute the原创 2017-04-27 15:06:37 · 434 阅读 · 0 评论 -
CodeForces 472D Design Tutorial: Inverse the Problem (最小生成树+lca)
There is an easy way to obtain a new task from an old one called “Inverse the problem”: we give an output of the original task, and ask to generate an input, such that solution to the original problem原创 2017-05-15 17:41:42 · 578 阅读 · 0 评论 -
poj 2387(Dijkstra优先队列优化)
DescriptionBessie 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 want原创 2017-04-25 22:48:42 · 715 阅读 · 0 评论 -
poj 2253 Frogger(dijkstra变形)
DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dirty and full of tou原创 2017-04-25 23:37:30 · 239 阅读 · 0 评论 -
poj 1797(dijkstra变形)
DescriptionBackground Hugo Heavy is happy. After the breakdown of the Cargolifter project he can now expand business. But he needs a clever man who tells him whether there really is a way from the pl原创 2017-04-26 12:30:19 · 516 阅读 · 0 评论 -
LightOJ 1074 O - Extended Traffic(SPFA判断负环)
Problem DescriptionDhaka city is getting crowded and noisy day by day. Certain roads always remain blocked in congestion. In order to convince people avoid shortest routes, and hence the crowded roads,原创 2017-05-08 23:22:48 · 398 阅读 · 0 评论 -
poj 3268 Silver Cow Party (dijkstra+置换矩阵处理)
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) unidirectional (原创 2017-04-26 16:06:55 · 363 阅读 · 0 评论 -
codevs 1078 最小生成树
题目描述 Description 农民约翰被选为他们镇的镇长!他其中一个竞选承诺就是在镇上建立起互联网,并连接到所有的农场。当然,他需要你的帮助。 约翰已经给他的农场安排了一条高速的网络线路,他想把这条线路共享给其他农场。为了使花费最少,他想铺设最短的光纤去连接所有的农场。 你将得到一份各农场之间连接费用的列表,你必须找出能连接所有农场并所用光纤最短的方案。 每两个农场间的距离不会超过100000原创 2017-05-17 20:36:11 · 292 阅读 · 0 评论 -
codevs 1231 最优布线问题(最小生成树模板)
题目描述 Description 学校需要将n台计算机连接起来,不同的2台计算机之间的连接费用可能是不同的。为了节省费用,我们考虑采用间接数据传输结束,就是一台计算机可以间接地通过其他计算机实现和另外一台计算机连接。为了使得任意两台计算机之间都是连通的(不管是直接还是间接的),需要在若干台计算机之间用网线直接连接,现在想使得总的连接费用最省,让你编程计算这个最小的费用。输入描述 Input Des原创 2017-05-17 21:19:04 · 303 阅读 · 0 评论 -
Arctic Network POJ - 2349 (最小生成树Kruskal)
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: every ou原创 2017-08-26 17:52:55 · 281 阅读 · 0 评论