http://www.lydsy.com/JudgeOnline/problem.php?id=2157 在对树中数据进行改动的时候需要很多pushdown(具体操作见代码),不然会wa,大概原因和线段树区间修改需要很多pushup是一样的。 这个轻重链的方法特别好用,虽然第一次写树链剖分但是容易理 ...
分类:
其他好文 时间:
2017-11-05 12:20:39
阅读次数:
177
立方数(cubic) Time Limit:1000ms Memory Limit:128MB 题目描述 LYK定义了一个数叫“立方数”,若一个数可以被写作是一个正整数的3次方,则这个数就是立方数,例如1,8,27就是最小的3个立方数。 现在给定一个数P,LYK想要知道这个数是不是立方数。 当然你有 ...
分类:
其他好文 时间:
2017-11-05 12:13:38
阅读次数:
144
这个题先离散化,然后强行用线段树统计每个点的高度,就可以了,只需要区间修改和单点查询就好,不过数据范围可能是假的……因为题目100000,然后我按照线段树开了4倍空间,然后re了,直到开了8倍…… ...
分类:
其他好文 时间:
2017-10-28 23:15:06
阅读次数:
254
题目链接:https://vjudge.net/problem/HDU-4027 A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secre ...
分类:
其他好文 时间:
2017-10-25 01:04:27
阅读次数:
179
题目链接:https://vjudge.net/problem/POJ-3468 You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation i ...
分类:
其他好文 时间:
2017-10-24 22:32:00
阅读次数:
208
思路:二分答案水过 思路:贪心,水了45分,据说大佬的贪心可以水85分的。 正解思路:查分约束 记录前缀和sum[i](前缀和是指最终应该得到的答案的前缀和) 当i>=8时 应该满足条件:s[i]-s[i-8]>=a[i]; 0<=s[i]-s[i-1]<=b[i]; 当i< 8时 应该满足条件:s ...
分类:
其他好文 时间:
2017-10-16 17:59:52
阅读次数:
138
Re 【问题引入】 对于区间修改、区间查询这样的简单问题,打一大堆线段树确实是不划算,今天来介绍一下区间查询+区间修改的树状数组 【一些基础】 树状数组的基本知识不再介绍,请自行百度 我们假设sigma(r,i)表示r数组的前i项和,调用一次的复杂度是log2(i) 设原数组是a[n],差分数组c[ ...
分类:
编程语言 时间:
2017-10-13 21:18:44
阅读次数:
224
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic ...
分类:
其他好文 时间:
2017-10-07 14:48:49
阅读次数:
199
我的线段树真的没救了......还是多练几道吧....... You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add s ...
分类:
其他好文 时间:
2017-10-06 20:04:27
阅读次数:
194