- 博客(11)
- 收藏
- 关注
原创 【Splay】 HDU 1754 I Hate It
点击打开链接 区间最值模板 需要在两端设置两个结点( 查询 [ l, r ] 时需 将 l-1 转到根结点,r+1转到l-1的儿子结点 这时 r+1的左儿子就是答案 #include #include #include #include #include #include #include using namespace std; #include #include
2015-08-31 20:37:50 602
原创 【SPLAY】 [HNOI2002] 营业额统计 模板
点击打开链接 模板 #include #include #include #include #include #include #include using namespace std; #include #include #include #include #include #include #pragma comment(linker, "/STACK:10240
2015-08-31 16:13:00 496
原创 【SBT】 POJ 3481 Double Queue
点击打开链接 1 表示插入 点 2表示求最大值的点标 并删除 3表示求最小值的点标 并删除 0表示结束 模板题。增加了一个val 表示为输出的值 #include #include #include #include #include #include #include using namespace std; #include #include #include
2015-08-31 13:51:57 498
原创 【矩阵快速幂】 HDU 5411 CRB and Puzzle 等比
点击打开链接 题意显然是 求 A+A^2+A^3+....+A^m 这就是经典题目 矩阵乘法十种经典题目 递归解决 后半部分提取 A^(m/2) 该题再特判下 m==1的时候 #include using namespace std; typedef long long LL; const int mod=2015; struct mat { int s[55][55];
2015-08-21 10:53:18 542
原创 【瞎搞】 HDU 5416 CRB and Tree
点击打开链接 查询才10个 X^Y=S && X^S=Y X^Y^X=Y DFS处理出每个点到 节点1 的异或值 并统计每个异或值的数量 对于查询的值 S 枚举每个点的到根节点的异或值 可以知道另一个需要的异或值 先前处理了异或值的个数 还要注意S=0的时候 #include #include #include #include #include #incl
2015-08-20 19:30:24 485
原创 【树链剖分】 POJ 2763 Housewife Wind 边权
点击打开链接 题意: 操作0 X :求 当前位置到X 的长度 操作1 X Y :将第X条边长度更改为Y #include #include #include #include #include #include #include using namespace std; #include #include #include #include #include #pr
2015-08-19 09:40:08 550
原创 【树状数组】 HDU 5372 Segment Game
点击打开链接 题意: 两种操作 :a,b a=0:插入一个区间 长度为num 区间范围为[b,b+num] ( num表示为 这条区间的编号 第一个插入的 num=1,第二个插入的 num = 2 a=1:删除第b个区间 插入一个线段 要输出 在这个区间内的区间数量 维护线段左右两端的位置数量 ( 输出 大于等于左端点的数量 减去 大于右端点的数量) 所有的区间分成6种 容斥
2015-08-11 21:48:50 444
原创 【数据结构】 CF 547B Mike and Feet
点击打开链接 长度为n的一个数列 定义 一个区间内的 最小的值为 这个区间的strength 求长度为 1-n 的区间 最大的strength 先求出每个位置左边/右边 的比它小的值的位置 这样在 L+1 R-1 区间内这个位置是最小值 然而 区间[len]的值是小于等于区间[len-1] 即可以推出 #include using namespace std; typ
2015-08-07 21:12:12 870
原创 【瞎搞】 HDU 5358 First One
点击打开链接 根据| log2 a +1 | =k 枚举k得到 区间 [2^(k-1), 2^k-1] ; k =[0,34] 再枚举左端 i: 对于一个i 找到一个区间 [l, r]满足[ 2^(k-1), 2^k-1] 然后就加起来 #include #include #include #include #include #include #include us
2015-08-06 21:51:26 461
原创 【分块】UVA 12003 Array Transformer 水题
点击打开链接 比较水的分快,还不会爆LL #include #include #include #include #include #include #include using namespace std; #include #include #include #include #include #include typedef long long LL; co
2015-08-04 09:36:03 528
原创 【划分树】 HDU 3473 Minimum Sum 中位数
点击打开链接 题意:在给出有N个数的数列 然后Q个询问 询问 [ L,R ] 要那个公式的值最小 显然是这个区间的中位数嘛 然后就要处理出 小于中位数的数的和 大于中位数的数的和 对于划分树来说 每一层的区间上的数build后,其相对位置都不会变化滴 所以在build 的时候统计下分到左边的数的前缀和 查询的时候统计小于中位数的数的和 {注释那一块} #inclu
2015-08-03 14:49:22 583
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人