随笔分类 -  数据结构——分块和莫队

摘要:"ref" 阅读全文
posted @ 2018-05-02 15:29 poorpool 阅读(178) 评论(0) 推荐(0) 编辑
摘要:"ref" cpp include include include include using namespace std; typedef long long ll; int n, q, a[100005], l[100005], r[100005], sta[100005], din, blc, 阅读全文
posted @ 2018-04-30 13:59 poorpool 阅读(195) 评论(0) 推荐(0) 编辑
摘要:这竟然是一道分块题…… cpp include include include include using namespace std; int n, m, q, blc, qnt, fa[50005], mxa[50005], mxb[50005], sz[50005], bcj, ans[500 阅读全文
posted @ 2018-04-27 16:14 poorpool 阅读(249) 评论(0) 推荐(0) 编辑
摘要:"ref" cpp include include include include using namespace std; typedef long long ll; int ua, ub, uc, ud, n, m, a[50005], chu[50005], blc, bel[50005], 阅读全文
posted @ 2018-04-17 07:59 poorpool 阅读(97) 评论(0) 推荐(0) 编辑
摘要:分块+权值逆序对 阅读全文
posted @ 2018-03-16 14:33 poorpool 阅读(142) 评论(0) 推荐(0) 编辑
摘要:看 "这里" 阅读全文
posted @ 2018-03-04 09:33 poorpool 阅读(100) 评论(0) 推荐(0) 编辑
摘要:```cpp include include include include using namespace std; int n, m, a[50005], blc, bel[50005], cnt[50005]; long long ansfz[50005], ansfm[50005], ans 阅读全文
posted @ 2018-03-01 16:21 poorpool 阅读(148) 评论(0) 推荐(0) 编辑
摘要:算法竞赛进阶指南p219,这里是分块。 当然也可以树套树来个动态二维数点。 cpp include include include include include using namespace std; typedef long long ll; int xx, yy, n, uu, vv, bl 阅读全文
posted @ 2018-02-28 20:52 poorpool 阅读(165) 评论(0) 推荐(0) 编辑
摘要:```cpp #include #include #include #include #include #include #include using namespace std; int n, m, bel[40005], a[40005], blc, f[1005][1005], cnt[40005], idx, ans; int val[40005], uu, vv; map ... 阅读全文
posted @ 2018-02-28 13:54 poorpool 阅读(157) 评论(0) 推荐(0) 编辑
摘要:"hzwer的讲解" 一 给出一个长为 $n$ 的数列,以及 $n$ 个操作,操作涉及区间加法,单点查值。 cpp include include include include include using namespace std; int n, blc, a[50005], tag[50005 阅读全文
posted @ 2018-02-23 21:48 poorpool 阅读(435) 评论(0) 推荐(0) 编辑
摘要:可以用树状数组,线段树,分块做。代码是分块 cpp include include include using namespace std; typedef long long ll; int n, m, uu, vv, ww, blc, bel[100005]; ll sum[100005], t 阅读全文
posted @ 2018-02-23 16:45 poorpool 阅读(87) 评论(0) 推荐(0) 编辑
摘要:参考 "这里" 我们先预处理模数在 $\sqrt{n}$ 以内的询问。 要是模数在 $\sqrt{n}$ 以外,直接暴力统计,反正这样的数又不会超过 $\sqrt{n}$ 个。 修改的时候也是。要是在 $\sqrt{n}$ 以内就把预处理的答案减去原数加上新数。 然后再把原数改掉。 然后再优化一下, 阅读全文
posted @ 2018-01-15 16:46 poorpool 阅读(123) 评论(0) 推荐(0) 编辑
摘要:莫队裸题还不带修改 cpp include include include include using namespace std; int n, m, qcnt, ans, col[1000005], bse, blc[50005], a[50005], qwq[200005]; struct Q 阅读全文
posted @ 2018-01-03 19:23 poorpool 阅读(127) 评论(0) 推荐(0) 编辑
摘要:莫队算法模板 推荐阅读 "这篇博客" cpp include include include include using namespace std; int n, m, bse, blc[10005], a[10005], qCnt, cCnt, qwq[10005], ans=0; int cn 阅读全文
posted @ 2018-01-03 19:02 poorpool 阅读(175) 评论(5) 推荐(0) 编辑