Convert +/- assignment to subset-sum counting.
Let P be sum of numbers assigned +.
Then P - (S-P) = target => 2P = S + target.
If S+target is odd or |target|>S, answer is 0.
Otherwise count subsets summing to P using 0/1 knapsack counting DP.
Choosing which numbers are + uniquely determines signs; zeros naturally double counts via DP.
Convert +/- assignment to subset-sum counting.
Let P be sum of numbers assigned +.
Then P - (S-P) = target => 2P = S + target.
If S+target is odd or |target|>S, answer is 0.
Otherwise count subsets summing to P using 0/1 knapsack counting DP.
Choosing which numbers are + uniquely determines signs; zeros naturally double counts via DP.