#K76727. Equal Sum Partition

    ID: 34707 Type: Default 1000ms 256MiB

Equal Sum Partition

Equal Sum Partition

Given a list of non-negative integers, determine if it is possible to partition the list into two non-empty sublists such that the sum of the elements in both sublists is equal. Formally, let the array be \(A = [a_1, a_2, \dots, a_n]\). You need to decide whether there exists a non-empty subset \(S \subset A\) (and its complement, which is also non-empty) such that

[ \sum_{x \in S} x = \sum_{x \in A \setminus S} x ]

If such a partition exists, print True; otherwise, print False.

Note: Both sublists must be non-empty.

inputFormat

The input is read from standard input. The first line contains an integer \(n\) representing the number of elements in the array. The second line contains \(n\) space-separated non-negative integers.

outputFormat

Output to standard output a single line containing True if the array can be partitioned into two non-empty sublists with equal sum, and False otherwise.

## sample
4
1 5 11 5
True