
可持久化数据结构
SwustLpf
长得帅~~~
展开
-
51nod 1174 区间中最大的数
#include"iostream" using namespace std; const int maxn=1e4+5; struct Tree { int l,r,Max; }; Tree tree[maxn<<2]; int a[maxn]; void BuildTree(int id,int L,int R) { tree[id].l=L; tree[id].r=R;原创 2017-12-04 12:28:01 · 186 阅读 · 0 评论 -
求区间第k大(小)的数
include”iostream” include”vector” include”algorithm” include”string.h” using namespace std; const int maxn=5e4+5; struct Tree { int l,r,c; }; int Size; Tree tree[maxn*30]; int a[原创 2018-02-01 18:40:56 · 614 阅读 · 0 评论 -
HDU4838 To the moon
http://acm.hdu.edu.cn/showproblem.php?pid=4348 #include"iostream" #include"cstdio" using namespace std; const int maxn=1e5+5; int Scan() { int res = 0, flag = 0; char ch; if((ch = getchar...原创 2018-03-04 16:48:45 · 295 阅读 · 0 评论 -
2018牛客小白月赛9
文章目录C-红球进黑洞E-换个角度思考 C-红球进黑洞 https://ac.nowcoder.com/acm/contest/275/C 题意: 两种操作: 操作1:是求区间[L,R]的和 操作2:把[L,R]区间的每个数都异或一个数 k 最开始没反应过来,异或的和不等于和的异或,很傻逼地写了半天。。。最会发现不会诶T_T 然后看题解,真的很厉害,他是保存每段区间内,各个位上有多少个1,然后通过...原创 2018-11-24 11:19:14 · 321 阅读 · 0 评论 -
主席树求区间[L,R]内小于等于x的个数【模板】
文章目录题目链接:hdu4417 题目链接: hdu 4417 Super Mario 牛客小白月赛9 E hdu4417 /*主席树求[L,R]内小于等于x的个数*/ #include"bits/stdc++.h" using namespace std; typedef long long LL; const int maxn=2e6+5; int Ls[maxn],Rs[maxn],tree...原创 2018-11-23 12:31:45 · 1298 阅读 · 0 评论