#C8014. Minimum Subset Difference
Minimum Subset Difference
Minimum Subset Difference
Given a list of non-negative integers, you are to partition them into two subsets such that the absolute difference between the sums of the two subsets is minimized.
Let the array be \(A = [a_1, a_2, \ldots, a_n]\) and let \(S = \sum_{i=1}^{n} a_i\). We aim to find a subset \(A' \subseteq A\) with sum \(S'\) so that the absolute difference \(|(S - S') - S'|\) is minimized. Equivalently, we wish to minimize \( |S - 2S'| \).
Your task is to compute and output this minimized difference.
inputFormat
The first line contains an integer \(n\) representing the number of elements.
The second line contains \(n\) space-separated non-negative integers.
outputFormat
Output a single integer which is the minimum absolute difference between the sums of the two subsets.
## sample4
1 6 11 5
1