莫队
Mongo_w
本人很菜
新个人主页https://training.517coding.com/%E7%94%A8%E6%88%B7:Laijunxu
我的luogu:https://www.luogu.com.cn/user/78127
展开
-
T2正解
/* 带修莫队+值域分块 */ #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; const int N = 2000010 , M = 4000010; int h[N] , to[M] , nxt[M] , tot; int n , m , LEN , tim; in原创 2020-12-12 16:40:50 · 96 阅读 · 0 评论 -
带有?的莫队
写莫队如同吸毒,易上头(误 莫队是一种用来统计(注意不是维护)区间各种东西的数据结构,由于其短小精悍,拓展性强而让人欲罢不能 常用的莫队有四种,其中树上莫队有个前置芝士要点,这里只会简单提一下 列表 普通莫队 带修莫队 回滚莫队 树上莫队 一个一个来讲 普通莫队 本质思想是继承前面的状态 A:举个栗子? Q:假设我们已经处理好了区间[l , r], 特殊化的,对于下一个区间[l , r’],我们只需要统计[r + 1 , r’]即可 推广到一般,对于下一个区间[l’ , r’],我们处理[l , l’]原创 2020-11-25 19:56:28 · 72 阅读 · 0 评论