整理板子的时候翻出来的题,放在一起写是因为都是Kruskal纯板子题。 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm> 5 #include<cmath> 6 #include<str ...
分类:
Web程序 时间:
2019-11-03 14:44:51
阅读次数:
97
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that c ...
分类:
其他好文 时间:
2019-10-29 13:38:19
阅读次数:
92
题目链接:http://poj.org/problem?id=1751 题目大意: 1.给出n个城市的坐标,以及m行,是a,b两个城市已经连通。需要求出联通所有城市的最小距离。 题解思路: 1.Kruscal。 2.注意在初始化时,已经联通的点,要联通它们的父亲节点。 1 #include<stdi ...
分类:
其他好文 时间:
2019-10-10 20:45:28
阅读次数:
106
题目链接 题意: 二维坐标系上, 给出n个顶点的坐标, 有m个组顶点之间距离为0, 输出最小生成树中所有距离不为0的边的两点的坐标 题解: 裸最小生成树板子 只需要求出任意两点之间的距离即可 代码: #include<iostream> #include<stdio.h> #include<math ...
分类:
其他好文 时间:
2019-10-02 12:26:28
阅读次数:
89
Highways POJ 1751 最小生成树 Prim算法 题意 有一个N个城市M条路的无向图,给你N个城市的坐标,然后现在该无向图已经有M条边了,问你还需要添加总长为多少的边能使得该无向图连通.输出需要添加边的两端点编号即可。 解题思路 这个可以使用最短路里面的Prim算法来实现,对于已经连接的 ...
分类:
编程语言 时间:
2019-09-27 23:23:38
阅读次数:
151
It is vitally important to have all the cities connected by highways in a war. If a city is conquered by the enemy, all the highways from/toward that ...
分类:
其他好文 时间:
2019-09-11 11:26:40
阅读次数:
95
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aware ...
分类:
其他好文 时间:
2019-08-06 18:24:38
阅读次数:
96
1030 Travel Plan (30 分) 1030 Travel Plan (30 分) 1030 Travel Plan (30 分) A traveler's map gives the distances between cities along the highways, togeth ...
分类:
其他好文 时间:
2019-06-24 09:14:46
阅读次数:
85
题目 : Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flato ...
分类:
其他好文 时间:
2019-03-14 13:13:01
阅读次数:
155
1033 To Fill or Not to Fill (25 分) With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a ca ...
分类:
其他好文 时间:
2019-02-26 01:11:32
阅读次数:
182