差分数组
古城白衣少年i
这个作者很懒,什么都没留下…
展开
-
牛客-算式子(思维+差分)
题目链接:https://ac.nowcoder.com/acm/contest/6290/E这个题目要将求得的m个结果进行异或后输出结果。对于每一个结果x的值是一定的,但有n个ai值,求1.对于前半部分,因为x的值一定,只需统计 [k*x,(k+1)*x) 的ai的数即可。2.对于后半部分较为麻烦,显然对于每个x,只需计算比x小的ai。遍历每一个值,利用差分数组来进行统计。对于任意一个值a来说,在[a,2*a)区间的数,结果为1,ans[a]++,在[2*a,3*a)区间的数结果为2.原创 2020-07-16 16:59:30 · 164 阅读 · 0 评论 -
HDU - 6514 - Monitor (二维差分数组)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6514题目:MonitorXiaoteng has a large area of land for growing crops, and the land can be seen as a rectangle of n×mn×m.But recently Xiaoteng found t...原创 2020-02-22 13:25:56 · 280 阅读 · 0 评论