Practice · 1 of 5
Many Subset-Sum Queries
CHALLENGE
Difficulty: advanced+25 XP
**Bài toán.** Given n ≤ 24 items and q ≤ 2000 target sums S_j, for each query print the number of subsets summing exactly to S_j. **Constraints:** 1 ≤ n ≤ 24; 1 ≤ q ≤ 2000; |a[i]| ≤ 10^9; |S_j| ≤ 10^12. Precompute both halves ONCE; answer each query with a join.
Press Submit to check your solution.
Back to lesson: Practice: Attack Pattern Drills