10 2022 档案
摘要:Description 要求使用树状数组完成区间之和查询,区间加上某一相同数值的操作。 Solution 树状数组是用来单点加,查前缀和的。若要实现区间加,可以将原数列差分,然后在l位置处+val,在r+1处-val,这时要查询的就成了在差分数列上前缀和的前缀和,即二阶前缀和。 $$ Sum = \
阅读全文
摘要:Description There is an integer sequence of length $2^N$: $A_0, A_1, ..., A_{2^N-1}$. (Note that the sequence is 0-indexed.) For every integer K satis
阅读全文
摘要:description Two integers x and y are compatible, if the result of their bitwise "AND" equals zero, that is, a & b = 0. For example, numbers 90 (101101
阅读全文