![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
zt_1995
这个作者很懒,什么都没留下…
展开
-
List Leaves
03-树2. List Leaves (25) 时间限制 :400 ms 内存限制:65536 kB 代码长度限制:8000 BGiven a tree, you are supposed to list all the leaves in the order of top down, and left to right.Input Specification:Each input file c原创 2015-07-23 10:30:09 · 294 阅读 · 0 评论 -
poj1741 树分治
题目链接:http://poj.org/problem?id=1741可参考论文:https://wenku.baidu.com/view/e087065f804d2b160b4ec0b5.html题意:求树上的点对(u,v)个数,点对满足dist(u,v)解法:树上点分治。树上递归求解问题,为了防止递归过程中树退化成一条链,我们每次递归时找树的重心。重心求原创 2017-03-04 23:40:05 · 359 阅读 · 0 评论 -
poj1655 求树的重心
题目链接:http://poj.org/problem?id=1655题意:求树的重心。解法:对树进行dfs,记录对于某个节点它的子树大小son[u],在dfs的时候可以处理出来这个点的所有子树节点个数的最大值Max,而n-son[u]可以处理出它父节点延伸出去的节点数目,那么答案便可以找到了。#include<cstdio>#include<cstring>#include<algorithm原创 2017-02-28 23:54:37 · 234 阅读 · 0 评论 -
poj2299
Ultra-QuickSortTime Limit: 7000MS Memory Limit: 65536KTotal Submissions: 51330 Accepted: 18828DescriptionIn this problem, you have to analyze a particular sorting a原创 2016-02-15 20:54:02 · 402 阅读 · 0 评论 -
hdu3410 单调队列
**Passing the Message**Problem Description What a sunny day! Let’s go picnic and have barbecue! Today, all kids in “Sun Flower” kindergarten are prepared to have an excursion. Before kicking of原创 2015-12-22 11:07:10 · 305 阅读 · 0 评论 -
FZU 1962 新击鼓传花游戏
题目:http://acm.fzu.edu.cn/problem.php?pid=1962线段树存人数来解题#include<iostream>#include<cstdio>using namespace std;int a[2000001];void update(int rt) { a[rt]=a[rt<<1]+a[rt<<1|1];}void build(int l,int r原创 2015-07-18 10:11:33 · 386 阅读 · 0 评论