Submit | All submissions | Best solutions | Back to list |
HS10EXRC - Get Stronger |
To shape his strength, Robert is doing weightlifting. His training set consists of n < 20 weight plates: x1, x2, ..., xn (1 ≤ xi ≤ 20}. Check, if he is able to compose a total weight of X with his training set.
Input data specification
First, an integer t < 500, describing the number of test cases. Next, for each of the test cases: X, n, and n integers.
Output data specification
For each of the test cases print one word: YES if Robert will be able to compose the required weight, or the word NO if this is impossible.
Example
Input: 4 5 3 2 1 3 18 3 11 10 9 5 4 1 2 1 6 23 5 11 1 2 10 18 Output: YES NO NO YES
Scoring
By solving this problem you score 10 points.
Added by: | kuszi |
Date: | 2011-03-25 |
Time limit: | 1s-2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 CLOJURE PERL6 |
Resource: | High School Programming League 2010/11 |