#K70287. Balloon Subset Sum
Balloon Subset Sum
Balloon Subset Sum
You are given a target integer \( k \) and a list of balloon sizes. Your task is to determine whether it is possible to select a subset of the provided balloons such that the sum of their sizes equals the target \( k \). Each balloon can only be used once.
For example, if \( k = 5 \) and the available sizes are [1, 2, 3], one valid subset is [2, 3] since \( 2 + 3 = 5 \).
inputFormat
The input begins with an integer \( T \) denoting the number of test cases. For each test case, the format is as follows:
- First line: An integer \( k \) representing the target sum.
- Second line: An integer \( m \) indicating the number of available balloons.
- Third line: \( m \) space-separated integers, each representing the size of a balloon.
outputFormat
For each test case, output a single line containing either "YES" if a subset of balloons exists with sum equal to \( k \), or "NO" otherwise.
## sample3
5
3
1 2 3
10
4
2 5 3 6
7
2
3 6
YES
YES
NO
</p>