#K71272. Equal Sum Subset Partition

    ID: 33495 Type: Default 1000ms 256MiB

Equal Sum Subset Partition

Equal Sum Subset Partition

You are given a list of integers. Your task is to determine whether it is possible to partition the list into two subsets such that the sum of one subset is exactly equal to (\frac{S}{2}), where (S) is the sum of all the integers in the list. This is equivalent to finding a subset that sums to (\frac{S}{2}).

For example, given the list [1, 5, 11, 5], the sum is 22 and (\frac{22}{2} = 11). Since one subset [11] sums to 11, the answer is True.

inputFormat

The input is given from standard input (stdin) and consists of two lines. The first line contains an integer (n) denoting the number of elements in the list. The second line contains (n) space-separated integers.

Example: 4 1 5 11 5

outputFormat

Output a single line to standard output (stdout) containing either True or False, indicating whether the list can be partitioned into two subsets with equal sum.## sample

4
1 5 11 5
True