#C12021. Zero Sum Subset

    ID: 41403 Type: Default 1000ms 256MiB

Zero Sum Subset

Zero Sum Subset

You are given an integer \(n\) and an array of \(n\) integers. Your task is to determine whether there exists a non-empty subset of the array whose sum is exactly zero. A subset can consist of any selection of elements (not necessarily contiguous) from the array.

Note: The empty subset is not considered. You should output YES if such a subset exists and NO otherwise.

Example:

Input:
5
-1 3 2 -2 5

Output: YES

</p>

The problem requires checking every possible non-empty subset. A brute-force approach using bitmasking or combinations is acceptable since the array size \(n\) is kept reasonably small.

inputFormat

The input is given via standard input (stdin) and consists of two lines:

  1. The first line contains an integer \(n\) representing the number of elements in the array.
  2. The second line contains \(n\) space-separated integers representing the array elements.

outputFormat

Output via standard output (stdout) a single line containing YES if there exists a non-empty subset whose sum is 0, otherwise output NO.

## sample
5
-1 3 2 -2 5
YES