#K9956. Minimum Partition Difference
Minimum Partition Difference
Minimum Partition Difference
Given a list of integers, your task is to partition it into two non-empty subsets such that the absolute difference between the sums of the two subsets is minimized.
You need to output three integers separated by a space: the minimum absolute difference, the sum of one subset, and the sum of the other subset.
The absolute difference is defined as \( |S_1 - S_2| \), where \( S_1 \) and \( S_2 \) are the sums of the two subsets respectively.
Note: It is guaranteed that a valid partition exists for each test case.
inputFormat
The input is read from stdin and is formatted as follows:
- The first line contains an integer \( T \), the number of test cases.
- For each test case, the first line contains an integer \( n \), the number of elements in the list.
- The second line contains \( n \) space-separated integers.
outputFormat
For each test case, output a single line to stdout containing three space-separated integers: the minimum absolute difference, the sum of one subset, and the sum of the other subset.
## sample1
5
7 3 2 5 8
1 12 13