大意: 给定一个基环树, 求删除一条环上的边使得直径最小. 直径分两种情况 环上点延伸的树内的直径 两个环上点的树内深度最大的点匹配 第一种情况直接树形dp求一下, 第二种情况枚举删除的环边, 线段树维护一下即可. ...
分类:
其他好文 时间:
2019-10-05 00:35:56
阅读次数:
85
题目链接 题意: 把各个岛屿看成一个点,求各个岛屿之间权值最小的路径(最小生成树) 对于数据 数据输入的第一行n代表岛屿的个数,当为0时程序结束。 接着n-1行开始为岛屿的编号,用大写字母表示,接着是一个整数k,表示与该岛屿连接的岛屿个数,然后该行输入m对数据 字母表示岛屿编号 接着一个整数w表示, ...
分类:
其他好文 时间:
2019-10-02 10:31:50
阅读次数:
74
23.7% 1000ms 262144K To seek candies for Maomao, Dudu comes to a maze. There are nn rooms numbered from 11 to nn and mm undirected roads. There are tw ...
分类:
其他好文 时间:
2019-09-15 01:03:26
阅读次数:
100
Description Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 所有towns连通。 Byteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的r ...
分类:
其他好文 时间:
2019-08-31 21:24:40
阅读次数:
98
It's almost summer time, and that means that it's almost summer construction time! This year, the good people who are in charge of the roads on the tr ...
分类:
其他好文 时间:
2019-08-31 21:06:14
阅读次数:
95
A group of cows grabbed a truck and ventured on an expedition deep into the jungle. Being rather poor drivers, the cows unfortunately managed to run o ...
分类:
其他好文 时间:
2019-08-22 16:07:12
阅读次数:
97
eg:用-替-换字符串里的特殊字符,并进行切分(括号里的不能替换) String roads = "G6包头..。?九原收费站((这个是.。--.。?测试)——210国道——幸福南路(备注:车、货、路线不变,往-返)——210国道(((aa)——210国道(这样呢)"; 一。思路:1.找到括号的区间 ...
分类:
其他好文 时间:
2019-08-21 11:36:04
阅读次数:
115
The Tourist Guide Mr. G. works as a tourist guide. His current assignment is to take some tourists from one city to another. Some two-way roads connec ...
分类:
其他好文 时间:
2019-08-16 22:45:48
阅读次数:
123
题目链接:https://vjudge.net/problem/POJ-1251 题目大意 略。 分析 最小生成树模板题,数据规模也很小,这里我用了 Prim 算法。 代码如下 1 #include <cmath> 2 #include <ctime> 3 #include <iostream> 4 ...
分类:
其他好文 时间:
2019-08-02 20:50:52
阅读次数:
86
Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the ...
分类:
编程语言 时间:
2019-07-30 00:17:13
阅读次数:
151