Computing Subset Sums with SOS DP and Fast Walsh-Hadamard Transform

Define ∩ as bitwise AND, ∪ as bitwise OR, and ⊕ as bitwise XOR. The notation i ⊆ x means the set of bits in binary representation i is a subset of x, i.e., i ∩ x = i. SOS DP (Sum Over Subsets) Given an array a, define F(x) = Σ a_i for all i ⊆ x. The goal is to compute F(x) for all x. Define dp[x][k] as the sum of a_i for all i that differ from ...

Posted on Thu, 16 Jul 2026 17:07:00 +0000 by mentor