生成树
mmk27
这个作者很懒,什么都没留下…
展开
-
HDU - 6187 Destroy Walls 最大生成树
Long times ago, there are beautiful historic walls in the city. These walls divide the city into many parts of area. Since it was not convenient, the new king wants to destroy some of these walls, so ...原创 2018-12-06 15:27:46 · 175 阅读 · 0 评论 -
Gym - 101911G Tree Reconstruction
Statements Monocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 11 to nn. For every edge eeof this tree, Mo...原创 2018-12-18 19:56:16 · 724 阅读 · 0 评论 -
ZOJ - 3204 Connect them 最小生成树
题目链接:点击查看 You havencomputers numbered from 1 tonand you want to connect them to make a small local area network (LAN). All connections are two-way (that is connecting computersiandjis the sam...原创 2019-03-08 21:16:28 · 121 阅读 · 0 评论 -
Object Clustering POJ - 3241 曼哈顿最小生成树
题目链接:https://cn.vjudge.net/problem/POJ-3241 题意:n个点,按照曼哈顿距离,形成k个集合后,使得每个集合任意两点的距离小于等于x,求最小的x 题解:也就是最小生成树中,第n-k小的边。曼哈顿最小生成树思路讲解:点击查看 #include<iostream> #include<cstdio> #include<algo...原创 2019-05-21 16:48:33 · 166 阅读 · 0 评论 -
曼哈顿距离最小生成树
一、前人种树 博客:曼哈顿距离最小生成树与莫队算法 博客:学习总结:最小曼哈顿距离生成树 二、知识梳理 曼哈顿距离:给定二维平面上的N个点,在两点之间连边的代价。(即distance(P1,P2) = |x1-x2|+|y1-y2|) 曼哈顿距离最小生成树问题求什么?求使所有点连通的最小代价。 最小生成树的“环切”性质:在图G= (V, E)中,如果存在一个环,那么把环上的最大...转载 2019-05-21 15:45:02 · 409 阅读 · 0 评论 -
Another Minimum Spanning Tree UVALive - 3662 曼哈顿最小生成树
题目链接:https://cn.vjudge.net/problem/UVALive-3662 题意:输出曼哈顿最小生成树的总距离和 题解:模板题,讲解:https://blog.csdn.net/mmk27_word/article/details/90408272 #include<iostream> #include<cstdio> #include<a...原创 2019-05-21 16:56:10 · 237 阅读 · 0 评论 -
问题 F: 猜球球 XUPT2019 哈夫曼树
题目链接:http://icpc.upc.edu.cn/problem.php?cid=1777&pid=5 题目描述 六一到了,为了庆祝这个节日,好多商家都推出了很多好玩的小游戏。Tongtong看到了一个猜球球的游戏,有n种除了颜色之外完全相同的球,商家从中拿出来一个球球放到了箱子里,已知第i种颜色的球出现在箱子里的概率为ai。Tongtong可以用下面这种方法来确定箱子中球的颜色...原创 2019-07-01 15:03:38 · 223 阅读 · 0 评论 -
2019 杭电多校 HDU - 6614 AND Minimum Spanning Tree 思维
题目链接:https://vjudge.net/problem/HDU-6614 题意:建一个树,使得权值和最小,边权为两点的 & 值 题解:对于 i 这个点 假设 二进制位101,那就和2这个点链接,假设为111,那就看一下有没有8这个点,没有的话就和点1连接 #include <bits/stdc++.h> using namespace std; typedef ...原创 2019-07-31 18:54:20 · 469 阅读 · 0 评论