#K15316. Partition Array into Two Equal Sum Subsets

    ID: 24330 Type: Default 1000ms 256MiB

Partition Array into Two Equal Sum Subsets

Partition Array into Two Equal Sum Subsets

You are given an array of integers. Your task is to determine if it is possible to partition the array into two non-empty subsets such that the sum of the elements in both subsets is equal. This problem requires you to carefully consider the subset sums. In mathematical terms, given an array A with total sum S, determine if there exists a subset B such that

[ \sum_{a \in B} a = \frac{S}{2} ]

If S is odd, the partition is impossible. Use dynamic programming to efficiently solve this problem.

inputFormat

The first line contains a single integer n indicating the number of elements in the array. The second line contains n space-separated integers representing the array elements.

outputFormat

Output a single line containing True if such a partition is possible, otherwise output False.

## sample
4
1 5 11 5
True