题目:http://www.lydsy.com/JudgeOnline/problem.php?id=2783题解:因为深度必须是递增的,所以就是从上到下的一条路径。 令d[i]表示i到根的路径,那么如果从x出发的满足题意的终点y必然有d[y]-d[fa[x]]=s 查询某个子树内某个值的出现次数?... Read More
posted @ 2015-01-29 13:21
ZYF-ZYF
Views(382)
Comments(0)
Diggs(0)
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=3521题解:我们考虑把p当作1,j当作-1,然后a[i]表示前缀和。 画到网格图上,我们很容易观察出,[l,r]满足题中的条件当且仅当 a[l-1]是a[l...r]的最小值,而a[r]是a[l.... Read More
posted @ 2015-01-29 07:42
ZYF-ZYF
Views(928)
Comments(0)
Diggs(1)