Can you determine a set of values from a set of distinct sums

Consider an array of positive integers $A$ of length $n$. Now consider the set of sums of all the contiguously indexed subarrays of $A$. For example if $A = (1,3,5,6)$ then the set would be $S_A = \{1,3,5,6,4,8,11,9,14,15\}$.

If the sums of all contiguously indexed subarrays are distinct (as they are in the example above), does the set of these sums uniquely specify the set of integers in the array the sums were calculated from?

We can certainly compute the smallest element in the original array as it is the smallest element in $S_A$. Similarly there must be a value in the original array which is the largest value in $S_A$ minus the second largest.

To show one of the subtleties of this problem, consider $A = (1, 6, 2, 3)$ and $S_A = \{1, 6, 2, 3, 7, 8, 5, 9, 11, 12\}$. We can immediately tell from $S_A$ that $1$ occurs somewhere in $A$. Similarly we can tell that $2$ occurs somewhere in $A$. But what can we tell about $3$? If $1$ and $2$ were next to each then as $1+2=3$ we would know that $3$ can't be in $A$. But if $1$ and $2$ are not next to each in $A$ then we know $3$ must be in $A$. How do we tell which case we are in?


The answer turns out to be NO. Take $A = (4, 6, 5, 2, 1)$ and $B = (3, 8, 2, 4, 1)$. We have that $S_A = S_B$ but the set of elements in $A$ and $B$ are distinct.


Solution 1:

The answer turns out to be NO. Take $A = (4, 6, 5, 2, 1)$ and $B = (3, 8, 2, 4, 1)$. We have that $S_A = S_B$ but the set of elements in $A$ and $B$ are distinct.