数据结构
岛屿失梦°
这个作者很懒,什么都没留下…
展开
-
点分治 模板题
就明白了个模板题,先放个模板。 多做一些题后在来整理下。 #pragma GCC optimize(3,"Ofast","inline") //G++ #include<bits/stdc++.h> #define mem(a,x) memset(a,x,sizeof(a)) #define debug(x) cout << #x << ": " <...原创 2020-04-12 05:49:52 · 100 阅读 · 0 评论 -
树的直径
树的直径 【定义】 我们将一棵树T = ( V,E )的直径定义为maxδ ( u,v ) ( u,v ∈ V ),也就是说,树中所有最短路径距离的最大值即为树的直径。 poj1985-添加链接描述 【做法】 做法1:2遍DFS 先从任意一点P出发,找离它最远的点Q,再从点Q出发,找离它最远的点W,W到Q的距离就是是的直径。 DFS从当前节点出发到达最远的点 第一次DFS返回的point肯定是直径...原创 2020-03-07 21:35:57 · 181 阅读 · 0 评论 -
CF-1237D(Balanced Playlist)
CF-1237D(Balanced Playlist) 好题 题目描述 Your favorite music streaming platform has formed a perfectly balanced playlist exclusively for you. The playlist consists of n tracks numbered from 1 to n. The p...原创 2019-10-18 14:30:05 · 371 阅读 · 0 评论 -
Elven Postman(HDU5444 二叉查找树)
Elven Postman(HDU5444 二叉查找树) 题目描述 Elves are very peculiar creatures. As we all know, they can live for a very long time and their magical prowess are not something to be taken lightly. Also, they live...原创 2019-07-25 15:54:47 · 124 阅读 · 0 评论