![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
可持久化
y20070316
这个作者很懒,什么都没留下…
展开
-
【BZOJ】3339 - Ⅱ - 变式Ⅰ
【题意】 有一个长度为nn的数组a1,a2,…,ana_1,a_2,…,a_n。mm次询问,每次询问一个区间[l,r][l,r]内最小没有出现过的自然数mex(al,al+1,...,ar)mex(al,al+1,...,ar)。【数据范围】 n,q≤200000n,q\leq 200000 0≤ai≤2000000\leq a_i\leq 200000且ai∈Za_i\in Z 0<l≤r原创 2016-01-21 21:47:55 · 342 阅读 · 0 评论 -
【SPOJ】Count on a Tree Ⅱ (COT2)
Foreword既然今天把莫队算法给复习了,又要准备AC糖果公园,那么就把树上莫队也给再写一遍先吧……OverviewYou are given a tree with N nodes. The tree nodes are numbered from 1 to N. Each node has an integer weight.We will ask you to perfrom the fol原创 2016-01-23 21:09:42 · 477 阅读 · 0 评论 -
【BZOJ】1878 HH的项链
Overview求区间不同数的个数。 N≤50000N\leq 50000,M≤200000M\leq 200000Analysis1. 莫队算法多个区间询问,有在线和离线的方法。先考虑离线吧。 按照块排序,使用莫队算法可以轻松解决。时间复杂度:O(nn−√)O(n\sqrt n)代码:#include <cstdio>#include <cmath>#include <cctype>#i原创 2016-01-23 23:39:11 · 667 阅读 · 1 评论