#C13444. Equal Sum Partition

    ID: 42983 Type: Default 1000ms 256MiB

Equal Sum Partition

Equal Sum Partition

Given an array of integers, determine whether the array can be partitioned into two subsets such that the sum of the elements in both subsets is equal. In other words, if the total sum of the array is \(S\), the task is to check whether there exists a subset whose sum is \(\frac{S}{2}\). Note that if \(S\) is odd, then such a partition is impossible.

The input is provided via standard input (stdin) and the output should be printed to standard output (stdout) as either Yes (if the partition exists) or No (if it does not).

inputFormat

The input consists of two lines:

  • The first line contains a single integer \(n\) (\(1 \le n \le 10^5\)), representing the number of elements in the array.
  • The second line contains \(n\) space-separated integers representing the array elements.

outputFormat

Output a single line: Yes if an equal sum partition exists; otherwise, output No.

## sample
4
1 5 11 5
Yes

</p>